intl

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

internal/intl: how the data is packaged

file what made by
data/<tag>.json.gz, global, plurals CLDR locale tables, one gzipped JSON document per locale, loaded on first use (data.go); the format is described in tools/intlgen/gen.js node tools/intlgen/gen.js
zoneinfo.zar the IANA time zone database: an internal/zpack archive (name -> TZif file, each deflated, aliases stored once), read by tzdata.go when the operating system has no database go generate ./internal/intl (reads the toolchain's $GOROOT/lib/time/zoneinfo.zip)
segment/ UAX #29 text segmentation tables (Go source) tools/intlgen/ucdgen.js

The Go API of the package is unchanged by how the data is stored. The archive format ("ZAR1") is documented in internal/zpack/zpack.go. The reasons for deflating embedded data, and what else was measured for the locale files (a preset dictionary: 6% smaller; a shared string table: 4%), are in docs/development.md, "Binary size budget".

Documentation

Overview

Package intl holds the data and the few natives behind the ECMAScript Intl API of Sweef's JavaScript engine (QuickJS ships no Intl): the locale tables generated from Unicode CLDR by tools/intlgen, time zone arithmetic on the embedded IANA database, and the Unicode text segmentation rules (grapheme, word, sentence). The formatting itself is JavaScript (internal/engine/platformjs/intl*.js); see docs/web-platform.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Global

func Global() string

Global returns the locale-independent tables (numbering systems, currency digits, hour cycles, week data, time zone names and aliases, metazone history).

func LocalZone

func LocalZone() string

LocalZone is the IANA name of the operating system's time zone ("UTC" when it cannot be told).

func Locale

func Locale(tag string) (string, bool)

Locale returns the JSON data of a locale tag ("en", "en-GB", "zh-Hant"); ok is false for a tag without data. Regional locales carry only their differences from the "parent" they name; the JavaScript side merges them.

func Plurals

func Plurals() string

Plurals returns the CLDR plural rules and plural ranges.

func ValidZone

func ValidZone(name string) bool

ValidZone reports whether name is a zone of the IANA database.

func ZoneOffset

func ZoneOffset(name string, ms int64) (offset int, dst bool, ok bool)

ZoneOffset returns the UTC offset in seconds of a zone at an instant (milliseconds since the epoch) and whether daylight saving time is in effect.

Types

This section is empty.

Directories

Path Synopsis
Package segment implements the Unicode text segmentation rules of UAX #29 (grapheme clusters, words, sentences) for Intl.Segmenter.
Package segment implements the Unicode text segmentation rules of UAX #29 (grapheme clusters, words, sentences) for Intl.Segmenter.

Jump to

Keyboard shortcuts

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