Documentation
¶
Overview ¶
Package cldr formats dates and times by the Unicode CLDR's data, as ICU and Intl write them, and transforms messages for the pseudo locales, for package i18n. tables.go holds the data of the locales of CLDR's modern coverage, generated from a pinned release of cldr-json by go generate (internal/gen).
Index ¶
Constants ¶
const ( PseudoAccents = "en-XA" PseudoBidi = "ar-XB" )
The pseudo locales, after Android's: en-XA accents and lengthens the source language's messages, ar-XB shows them right to left.
const ( ArgStart = "" ArgEnd = "" )
Marks around what an argument wrote in a message Pseudolocalize transforms: private use characters, which messages do not hold.
const Version = "48.2.0"
Version is the release of the Unicode CLDR the tables come from.
Variables ¶
This section is empty.
Functions ¶
func FormatDate ¶
func FormatDate(locale string, t time.Time, o DateOptions) string
FormatDate writes t, in its location, in the Gregorian calendar, in the way of locale: its patterns, names and digits. Time zones are written as offsets from GMT in the locale's format.
func Pattern ¶
func Pattern(locale string, o DateOptions) string
Pattern returns the CLDR pattern FormatDate writes for locale and o, as "MMM d, y".
func Pseudolocalize ¶
Pseudolocalize transforms s, a message in the source language whose arguments' text is between ArgStart and ArgEnd, as the pseudo locale tag shows it, keeping what the arguments wrote. Any other tag only drops the marks.
Types ¶
type DateOptions ¶
DateOptions are how FormatDate writes a time: its date, its time or both by style, or else the fields of Skeleton, CLDR's letters in any order ("yMMMd", "jm"), in the order and form the locale writes them. Neither is "yMd".
type Regional ¶
type Regional struct {
FirstDayOfWeek int
HourCycle string
MeasurementSystem string
TemperatureUnit string
}
Regional is how a locale's region reads weeks, times and measures, as CLDR 48's supplemental data has it, Intl's names for its values: FirstDayOfWeek 1 for Monday to 7 for Sunday (ISO 8601), HourCycle "h11", "h12", "h23" or "h24", MeasurementSystem "metric", "us" or "uk", TemperatureUnit "celsius" or "fahrenheit".
func RegionalOf ¶
RegionalOf is locale's regional preferences: what its Unicode extension sets (-u-fw-, -u-hc-, -u-ms-, -u-mu-), else its region's, likely or given, else its language's hours.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
gen
command
Command gen writes tables.go, the data of the Unicode CLDR package cldr formats dates with, from a pinned release of cldr-json: go generate ./internal/cldr runs it.
|
Command gen writes tables.go, the data of the Unicode CLDR package cldr formats dates with, from a pinned release of cldr-json: go generate ./internal/cldr runs it. |