number

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 6 Imported by: 0

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 number exposes generated CLDR number-formatting data.

It keeps symbols, decimal patterns, compact patterns, unit patterns, and currency metadata behind typed accessors for NumberFormat.

Only internal CLDR and NumberFormat code should use this package; public callers use numberformat APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportedLocales

func SupportedLocales() []string

SupportedLocales returns the locales with generated number data in sorted-locale order. It reads only the narrow supported blob and never triggers the main number-data decode.

func SupportedNumberingSystems added in v0.2.7

func SupportedNumberingSystems() []string

SupportedNumberingSystems returns the canonical numbering-system identifiers backed by generated number data merged with the ECMA-402 simple numbering systems, in sorted order. It reads only the narrow numbering-system blob and never triggers the main number-data decode.

Types

type Locale

type Locale uint16

Locale is the number-domain locale handle. It shares the kernel locale index space (see file header) and carries the number accessor methods in accessors.go.

func ResolveLocale

func ResolveLocale(tag string) (Locale, bool)

ResolveLocale resolves a tag to its number-domain locale handle, forwarding to the shared locale kernel so number handles index identically to every other domain.

func (Locale) CompactPattern added in v0.2.7

func (l Locale) CompactPattern(numberingSystem, display string, exponent int, plural string) string

CompactPattern returns the compact pattern for the (numberingSystem, display, exponent, plural) tuple, falling back to the "other" plural form. An empty numbering system defaults to the locale's default numbering system.

func (Locale) CurrencyNamePattern added in v0.2.17

func (l Locale) CurrencyNamePattern(numberingSystem, plural string) string

CurrencyNamePattern returns the currency-name placement pattern for the given numbering system and plural category. It falls back to "other" within that numbering system, then repeats the lookup in the locale default.

func (Locale) CurrencyPattern added in v0.2.7

func (l Locale) CurrencyPattern(numberingSystem, sign string) string

CurrencyPattern returns the currency pattern for the (numberingSystem, sign) pair, falling back to the locale's default numbering system and then the "standard" sign.

func (Locale) DecimalPattern added in v0.2.7

func (l Locale) DecimalPattern(numberingSystem string) string

DecimalPattern returns the decimal pattern for the given numbering system, defaulting to the locale's default numbering system when numberingSystem is empty or has no generated pattern row.

func (Locale) DefaultNumberingSystem added in v0.2.7

func (l Locale) DefaultNumberingSystem() string

DefaultNumberingSystem returns the locale's default numbering system from the generated number data.

func (Locale) NumberSymbols added in v0.2.7

func (l Locale) NumberSymbols(numberingSystem string) NumberSymbols

NumberSymbols returns the symbols for the given numbering system, defaulting to the locale's default numbering system when numberingSystem is empty or has no generated symbol row.

func (Locale) PercentPattern added in v0.2.7

func (l Locale) PercentPattern(numberingSystem string) string

PercentPattern returns the percent pattern for the given numbering system, defaulting to the locale's default numbering system when numberingSystem is empty or has no generated pattern row.

func (Locale) ScientificPattern added in v0.2.7

func (l Locale) ScientificPattern(numberingSystem string) string

ScientificPattern returns the scientific pattern for the given numbering system, defaulting to the locale's default numbering system when numberingSystem is empty or has no generated pattern row.

type NumberLocaleData

type NumberLocaleData struct{}

NumberLocaleData exposes the relevant extension keys used by Intl.NumberFormat ResolveLocale.

func (NumberLocaleData) For added in v0.2.7

func (NumberLocaleData) For(locale, key string) []string

For returns the candidate values for a relevant extension key. Only "nu" (numbering system) is meaningful for the number domain.

type NumberSymbols

type NumberSymbols struct {
	Decimal, Group, Percent, Plus, Minus, NaN, Infinity, ApproxSign, RangeSign, PerMille, Exponential, SuperscriptingExponent, TimeSeparator string
}

NumberSymbols holds the locale's numbering-system symbols in the wire order shared with the generator.

Jump to

Keyboard shortcuts

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