Documentation
¶
Overview ¶
Source: CLDR v48.1.0 / ICU 78 / tzdata 2025b (input hashes in internal/cldr/locale/manifest.go) Generated: reproducible from tools/gen-cldr with pinned inputs; no timestamps or machine-local paths Schema: SPECS/50-cldr-data.md#cldr-data-package-convention
Package cldrlocale exposes generated CLDR locale metadata.
It keeps likely subtags, locale preferences, numbering systems, collation names, and time-zone preferences behind typed accessors.
Only internal CLDR and locale negotiation code should use this package; public callers use locale and formatter APIs.
Source: CLDR v48.1.0 / ICU 78 / tzdata 2025b (input hashes in internal/cldr/locale/manifest.go) Generated: reproducible from tools/gen-cldr with pinned inputs; no timestamps or machine-local paths Schema: SPECS/50-cldr-data.md#cldr-data-package-convention
Index ¶
- func AvailableLocales() []string
- func CalendarPreference(region string) []string
- func FirstDayOfWeek(region string) time.Weekday
- func HasCalendarPreference(region string) bool
- func HasHourCyclePreference(region string) bool
- func HasWeekPreference(region string) bool
- func HourCyclePreference(region string) []string
- func IntersectSupportedLocales(primary []string, required ...[]string) []string
- func Maximize(tag string) string
- func MaximizeSubtags(language, script, region string) (lang, scr, reg string, ok bool)
- func MinimalDaysInFirstWeek(region string) int
- func MinimizeSubtags(language, script, region string) (lang, scr, reg string, ok bool)
- func TextDirection(script string) (direction string, ok bool)
- func Weekend(region string) (start, end time.Weekday)
- type DataManifest
- type InputHash
- type Locale
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableLocales ¶
func AvailableLocales() []string
AvailableLocales returns the kernel's available locale tags in sorted order (Locale index = position, "und" pinned at 0).
func CalendarPreference ¶
CalendarPreference returns the region's calendar preference list, falling back to the world ("001") default.
func FirstDayOfWeek ¶
FirstDayOfWeek returns the region's first day of the week.
func HasCalendarPreference ¶
HasCalendarPreference reports whether the region has an explicit calendar preference.
func HasHourCyclePreference ¶
HasHourCyclePreference reports whether the region has an explicit hour-cycle preference.
func HasWeekPreference ¶
HasWeekPreference reports whether the region has explicit week data.
func HourCyclePreference ¶
HourCyclePreference returns the region's hour-cycle preference list, falling back to the world ("001") default.
func IntersectSupportedLocales ¶ added in v0.2.9
IntersectSupportedLocales returns primary locales supported by every required locale list. It preserves primary order and returns a new slice.
func MaximizeSubtags ¶
MaximizeSubtags applies the CLDR Add Likely Subtags fallback order and preserves subtags already supplied by the caller.
func MinimalDaysInFirstWeek ¶
MinimalDaysInFirstWeek returns the region's minimal-days-in-first-week value.
func MinimizeSubtags ¶
MinimizeSubtags returns the minimized tag for the input subtags, or ok=false when the (language, script, region) triple is absent from the minimize table.
func TextDirection ¶ added in v0.2.16
TextDirection returns the CLDR direction for script. Unknown or missing script metadata returns ok=false.
Types ¶
type DataManifest ¶ added in v0.2.7
type DataManifest struct {
Generator string
CLDR string
ICU string
TZData string
LocaleProfile []string
InputHashes []InputHash
}
func Manifest ¶ added in v0.2.7
func Manifest() DataManifest
type Locale ¶
type Locale uint16
Locale is an opaque handle into the generated CLDR locale data.
const Undefined Locale = 0
Undefined is the "und" sentinel locale.
func ResolveLocale ¶
ResolveLocale resolves a tag to its kernel Locale handle, falling back to the base language subtag, or (Undefined, false) when neither is known.
func (Locale) DefaultNumberingSystem ¶
DefaultNumberingSystem returns the default numbering system for the locale, defaulting to "latn" for any locale without a non-latn override.
type VersionInfo ¶ added in v0.2.7
VersionInfo carries the CLDR / ICU / tzdata versions pinned in internal/cldr/VERSION at codegen time.
func Version ¶ added in v0.2.7
func Version() VersionInfo
Version returns the pinned data versions, sourced from the generated manifest.