translator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLangOption = "Default"

DefaultLangOption default language option. If user config the language is default, the language option is admin choose.

Variables

View Source
var GlobalTrans i18n.Translator
View Source
var (
	// LanguageOptions language
	LanguageOptions []*LangOption
)
View Source
var ProviderSet = wire.NewSet(NewTranslator)

ProviderSet is providers.

Functions

func CheckLanguageIsValid added in v0.3.0

func CheckLanguageIsValid(lang string) bool

CheckLanguageIsValid check user input language is valid

func NewTranslator

func NewTranslator(c *I18n) (tr i18n.Translator, err error)

NewTranslator new a translator

Types

type I18n

type I18n struct {
	BundleDir string `json:"bundle_dir" mapstructure:"bundle_dir" yaml:"bundle_dir"`
}

I18n i18n config

type LangOption added in v0.3.0

type LangOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

LangOption language option

Jump to

Keyboard shortcuts

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