Documentation ¶
Overview ¶
Package polyglot provides a simple string translation mechanism.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidLocale is returned if a specified locale is invalid. ErrInvalidLocale = errors.New("invalid locale") )
Functions ¶
This section is empty.
Types ¶
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict provides translated strings appropriate for a specific locale.
func NewDict ¶
NewDict returns a new Dict with the specified translations directory path and locale.
The directory will be scanned recursively for JSON encoded .tr translation files, as created by the polyglot tool, that have a name suffix matching one of the locales in the locale chain. Example: Locale "en_US" has chain ["en_US", "en"], so files like foo-en_US.tr, foo-en.tr, bar-en.tr, baz-en.tr would be picked up.
Click to show internal directories.
Click to hide internal directories.