Documentation
¶
Overview ¶
Package i18n provides internationalization support for PixivFE.
This file contains global functions and variables for setting and retrieving the current locale, as well as functions for translating user-facing errors and formatted strings.
This file loads translation files and looks up translations for given strings.
This file rewrites strings in Jet templates before they are parsed.
Index ¶
- Constants
- Variables
- func Error(text string) error
- func Errorf(format string, a ...any) error
- func GetLocale() string
- func Replacer(locale string, file string) *strings.Replacer
- func SetLocale(locale string)
- func Setup() error
- func Sprintf(format string, a ...any) string
- func SuccintID(file string, text string) string
- func Tag(tag string) string
- func Tr(text string) string
- type TrPairs
Constants ¶
View Source
const BaseLocale = "en"
BaseLocale is the default locale used when no specific locale is set.
View Source
const ( // CallerSkipFrames is the number of stack frames to skip to reach the calling function // that invokes the translation lookup. CallerSkipFrames int = 2 )
Variables ¶
View Source
var AvailableLanguages = []language{
{"en", "English"},
{"vi-VN", "Vietnamese"},
{"zh-TW", "Traditional Chinese"},
}
AvailableLanguages lists the languages supported by package i18n.
Functions ¶
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package main is a crawler to find i18n function calls in Go files.
|
Package main is a crawler to find i18n function calls in Go files. |
|
Package main provides a tool that reads JSON input from stdin, creates a translation map, outputs the result as JSON to stdout.
|
Package main provides a tool that reads JSON input from stdin, creates a translation map, outputs the result as JSON to stdout. |
|
This file implements a crawler for extracting translatable strings from HTML templates.
|
This file implements a crawler for extracting translatable strings from HTML templates. |
Click to show internal directories.
Click to hide internal directories.