Documentation
¶
Overview ¶
Package locale is the table of spreadsheet locales, as Sheets' File > Settings > Locale offers them: how numbers, dates and currency are typed and shown, and how formulas separate their arguments. It holds only the conventions, with no dependencies (no CLDR data): the packages that parse and render use them at their edges, while cells, formulas and files stay in the canonical form of en-US.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Canonical = &table[0]
Canonical is en-US: what cells, formulas and files store, whatever the locale shown.
var English = &Names{ Months: [12]string{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}, Short: [12]string{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}, Days: [7]string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}, DaysShort: [7]string{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}, }
English are en-US's names, which every English locale shares.
Functions ¶
Types ¶
type DateOrder ¶
type DateOrder uint8
DateOrder is the order of day, month and year in a date typed or shown with numbers only.
type Locale ¶
type Locale struct {
Tag string // BCP 47, as written in files and the config: "de-DE"
Name string // as the picker lists it: "German (Germany)"
// LCID is Windows' number for the locale, which Excel's format
// codes name it by: [$€-407], [$-407]d.m.yyyy.
LCID uint16
Decimal byte // the decimal separator: '.' or ','
Group string // the thousands separator shown: ",", ".", a no-break space, an apostrophe
Order DateOrder
DateSep byte // between the numbers of a date: '/', '.' or '-'
Date string // the Date format's pattern: "dd.mm.yyyy"
Time string // the Time format's pattern: "hh:mm:ss"
Currency string // the currency symbol: "€"
After bool // the symbol follows the number: "1.234,56 €"
Space bool // a space between the symbol and the number: "R$ 1.234,56"
// contains filtered or unexported fields
}
Locale is one locale's conventions.
func All ¶
func All() []*Locale
All returns every locale, en-US first, then as the table lists them.
func Lookup ¶
Lookup finds a locale by its tag, ignoring case and taking _ for -, so "de-DE", "de_de" and "DE-de" are the same. A language alone ("de") means its first locale in the table.
func (*Locale) ArgSep ¶
ArgSep separates a formula's arguments: ; where the decimal separator is a comma, as in Sheets, so 1,5 stays a number.
func (*Locale) ColSep ¶
ColSep separates the values of a row in an array literal: \ where the argument separator is ;, which also separates an array's rows.
func (*Locale) DateTime ¶
DateTime is the Date time format's pattern: the date, then the time on the 24-hour clock, as Sheets shows it in every locale.
func (*Locale) IsCanonical ¶
IsCanonical reports whether l types and shows everything as stored: en-US, or nil.
func (*Locale) IsGroup ¶
IsGroup reports whether r separates thousands in l as typed: its own separator, any space where it groups with a space, and ' for ’.
type Names ¶
type Names struct {
// Months are the months' full names as a date writes them, January
// first: "września" in "26 września 2026".
Months [12]string
// Alone are the full names where a month stands without its day
// ("wrzesień 2026"), in languages whose form differs; empty where
// it's Months.
Alone [12]string
// Short are the abbreviations mmm shows: "Sep", "sept.", "9月".
Short [12]string
// Days are the days' full names, Sunday first; DaysShort their
// abbreviations, as ddd shows them.
Days, DaysShort [7]string
// AM and PM are what AM/PM shows, where the language has words of
// its own; empty keeps AM and PM.
AM, PM string
}
Names are a language's names of months and days, as date formats show them (mmm, mmmm, ddd, dddd) and typed dates may spell them, and its words for the two halves of a 12-hour clock.