Documentation
¶
Overview ¶
Package i18next implements reading and writing of i18next JSON translation files.
The expected file format is:
{
"_meta": { "name": "Русский", "flag": "🇷🇺" },
"translations": {
"English key text": "Translated value",
"Another key": ""
}
}
Keys are natural English text. Empty string values mean untranslated (i18next falls back to the key itself as the English text).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LangMeta = func() map[string]Meta { out := make(map[string]Meta, len(langmeta.Registry)) for k, v := range langmeta.Registry { out[k] = Meta{Name: v.Name, Flag: v.Flag} } return out }()
LangMeta contains known language metadata for auto-fill.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Meta Meta
Translations map[string]string // key (English) -> value (translated)
// contains filtered or unexported fields
}
File represents a parsed i18next translation file.
func (*File) Marshal ¶
Marshal produces the JSON output matching the original i18next format with 4-space indentation and sorted keys.
func (*File) UntranslatedKeys ¶
UntranslatedKeys returns keys that have empty translations.
type Meta ¶
Meta holds the language metadata from the _meta field.
func ResolveMeta ¶
ResolveMeta returns best-effort language metadata for language codes, supporting variants like pt_BR, pt-BR, and region fallbacks.