i18n

package
v0.0.0-...-0e80e98 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SimplifiedChinese = Language{
		Key:   "zh-cn",
		Name:  "简体中文",
		Short: "简",
	}
	TraditionalChinese = Language{
		Key:   "zh-tw",
		Name:  "繁體中文",
		Short: "繁",
	}
	German = Language{
		Key:   "de-de",
		Name:  "Deutsch",
		Short: "DE",
	}
	English = Language{
		Key:   "en-us",
		Name:  "English",
		Short: "EN",
	}
	Spanish = Language{
		Key:   "es-es",
		Name:  "Español",
		Short: "ES",
	}
	French = Language{
		Key:   "fr-fr",
		Name:  "Français",
		Short: "FR",
	}
	Indonesian = Language{
		Key:   "id-id",
		Name:  "Indonesia",
		Short: "ID",
	}
	Japanese = Language{
		Key:   "ja-jp",
		Name:  "日本語",
		Short: "JP",
	}
	Korean = Language{
		Key:   "ko-kr",
		Name:  "한국어",
		Short: "KR",
	}
	Portuguese = Language{
		Key:   "pt-pt",
		Name:  "Português",
		Short: "PT",
	}
	Russian = Language{
		Key:   "ru-ru",
		Name:  "Pусский",
		Short: "RU",
	}
	Thai = Language{
		Key:   "th-th",
		Name:  "ภาษาไทย",
		Short: "TH",
	}
	Vietnamese = Language{
		Key:   "vi-vn",
		Name:  "Tiếng Việt",
		Short: "VN",
	}
)

Functions

func Locales

func Locales() map[Language]Locale

func ReadLocaleFile

func ReadLocaleFile(lang Language) ([]byte, error)

Types

type Language

type Language struct {
	Key   string `mapstructure:"key" json:"key"`
	Name  string `mapstructure:"name" json:"name"`
	Short string `mapstructure:"short" json:"short"`
}

func Default

func Default() Language

func Match

func Match(languages ...string) Language

func (Language) CanonicalKey

func (lang Language) CanonicalKey() string

func (Language) MustParse

func (lang Language) MustParse() language.Tag

func (Language) Parent

func (lang Language) Parent() language.Tag

func (Language) ParentVarName

func (lang Language) ParentVarName() string

func (Language) Tag

func (lang Language) Tag() language.Tag

func (Language) VarName

func (lang Language) VarName() string

type Locale

type Locale struct {
	Language          Language          `json:"language"`
	Characters        map[string]string `json:"characters"`
	CharactersInverse map[string]string `json:"charactersInverse"`
	Weapons           map[string]string `json:"weapons"`
	WeaponsInverse    map[string]string `json:"weaponsInverse"`
	Wishes            map[string]string `json:"wishes"`
	SharedWishes      map[string]string `json:"sharedWishes"`
}

func NewLocale

func NewLocale(lang Language) Locale

func ReadLocale

func ReadLocale(lang Language) (locale Locale, err error)

func (Locale) BaseFilename

func (l Locale) BaseFilename() string

func (Locale) JSON

func (l Locale) JSON() []byte

type WishType

type WishType struct {
	Key  string `json:"key" mapstructure:"key"`
	Name string `json:"name" mapstructure:"name"`
}

func (WishType) VarName

func (t WishType) VarName() string

Jump to

Keyboard shortcuts

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