internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestMode = false
)

Functions

func BuildMetazoneMap

func BuildMetazoneMap(cldrData *cldr.CLDR) map[string]string

BuildMetazoneMap builds a map of IANA timezone name → metazone name from the CLDR supplemental metazoneInfo data. Only the current (no "to" date) mapping is used.

func BuildParentLocaleMap

func BuildParentLocaleMap(cldrData *cldr.CLDR) map[string]string

BuildParentLocaleMap builds a map of locale -> parent from the CLDR supplemental parentLocales data, falling back to the default algorithm (strip rightmost component, then "root").

func Generate

func Generate(dataPath string) iter.Seq2[string, LocaleConfig]

Types

type CurrencyConfig

type CurrencyConfig struct {
	// StandardPattern is the CLDR standard currency format pattern (e.g. "#,##0.00 ¤").
	StandardPattern string
	// AccountingPattern is the CLDR accounting format pattern (e.g. "¤ #,##0.00;(¤ #,##0.00)").
	AccountingPattern string
	// CurrencySymbols maps currency code (e.g. "NOK") to its locale symbol (e.g. "kr").
	CurrencySymbols map[string]string
}

CurrencyConfig holds locale-specific currency formatting data.

type DateTimeConfig

type DateTimeConfig struct {
	DateFull   string
	DateLong   string
	DateMedium string
	DateShort  string
	TimeFull   string
	TimeLong   string
	TimeMedium string
	TimeShort  string
}

type Days

type Days [7]string

func (Days) Slice

func (d Days) Slice() []string

type LocaleConfig

func ResolveLocale

func ResolveLocale(loc string, cldrData *cldr.CLDR, parentOverrides map[string]string) LocaleConfig

ResolveLocale builds a fully inherited localeConfig by walking up the parent chain (e.g. nn -> no -> root) and merging.

func (LocaleConfig) String

func (d LocaleConfig) String() string

type Months

type Months [12]string

func (Months) Slice

func (m Months) Slice() []string

type MonthsConfig

type MonthsConfig struct {
	MonthsAbbreviated Months
	MonthsNarrow      Months
	MonthsWide        Months
}

type NumberConfig

type NumberConfig struct {
	Decimal        string
	Group          string
	Minus          string
	Percent        string
	PerMille       string
	Plus           string
	PercentPattern string
}

type TimeZoneNames

type TimeZoneNames map[string][2]string

TimeZoneNames maps metazone name → [standard, daylight] long names.

type WeekDaysConfig

type WeekDaysConfig struct {
	WeekDaysAbbreviated Days
	WeekDaysNarrow      Days
	WeekDaysShort       Days
	WeekDaysWide        Days
}

TODO1 consider intern.Unique.

Jump to

Keyboard shortcuts

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