i18n

package
v1.40.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 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.

Documentation

Overview

Package i18n shares MyGo's message catalogs with the native UI and pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDate added in v1.17.0

func FormatDate(t, now time.Time) string

FormatDate is FormatDateIn in the locale SetLanguage was given, which keeps the region the catalog match drops (en-GB is "en" for T, day-first here).

func FormatDateIn added in v1.17.0

func FormatDateIn(t, now time.Time, lang string) string

FormatDateIn is t's numeric date in lang (CLDR short date, Md / yMd), in now's zone, without the year in now's year: "01.10." / "01.10.2025" (de).

func FullDate added in v1.19.0

func FullDate(t time.Time) string

FullDate is FullDateIn in the locale SetLanguage was given.

func FullDateIn added in v1.17.0

func FullDateIn(t time.Time, lang string) string

FullDateIn is t's numeric date with the year in lang, in t's own zone.

func Keys

func Keys() []string

Keys returns the source catalog's message keys.

func Language

func Language() string

func Locale added in v1.40.0

func Locale() string

Locale is the tag SetLanguage was given, normalized: the interface language with its region ("en-GB"), as the dates in it are written.

func Match added in v1.36.0

func Match(tag string) string

Match returns the catalog language best matching tag (or "en") and accepts MyGo's pseudo locales for layout checks.

func Plural

func Plural(key string, n int) string

Plural uses the language's ICU plural rules.

func SetLanguage

func SetLanguage(tag string)

SetLanguage selects the catalog language best matching tag (or "en") and accepts MyGo's pseudo locales for layout checks.

func T

func T(key string) string

T retains the dotted keys used by dynamic menus and settings indexes.

func TIn added in v1.33.0

func TIn(lang, key string) string

TIn is T in lang, whatever the UI's language, for text a model reads.

func Tf

func Tf(key string, args ...any) string

Tf formats positional callers through the catalog's named ICU arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

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