localization

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package localization says how the person likes things shown: their languages, region, currency, and date and number formats.

nimbus native plugin add localization

l, err := localization.Get(ctx)
fmt.Sprintf("%s%d", l.CurrencySymbol, price)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Languages         []string `json:"languages"`         // in their order of preference, such as "en-IN"
	Language          string   `json:"language"`          // the first, without its region, such as "en"
	Region            string   `json:"region"`            // such as "IN"
	Currency          string   `json:"currency"`          // such as "INR"; empty for a region with none
	CurrencySymbol    string   `json:"currencySymbol"`    // such as "₹"
	TimeZone          string   `json:"timeZone"`          // such as "Asia/Kolkata"
	Uses24Hour        bool     `json:"uses24Hour"`        // 15:00, not 3:00 pm
	FirstWeekday      int      `json:"firstWeekday"`      // 1 is Sunday, 2 is Monday
	Metric            bool     `json:"metric"`            // kilometres, not miles
	DecimalSeparator  string   `json:"decimalSeparator"`  // as in 1.5
	GroupingSeparator string   `json:"groupingSeparator"` // as in 1,000
	RightToLeft       bool     `json:"rightToLeft"`       // their language reads that way
}

Info is the phone's settings.

func Get

func Get(ctx context.Context) (Info, error)

Get reads them. Ask again when the app comes back: people can change them while it's away.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL