Documentation
¶
Index ¶
- func LoadTranslationFiles(path string, translations DomainTranslations, domain *Domain)
- func TranslatorFilter(options ...OptionFn) factory.AppendFilterFn
- func WithTranslator(translator *Translator) factory.AppendFilterFn
- type Domain
- type DomainTranslations
- type Loader
- type Locale
- type LocaleTranslations
- type Option
- type OptionFn
- func AddDomainTranslations(domain, locale string, loader Loader) OptionFn
- func WithDefaultDomain() OptionFn
- func WithDefaultTranslations(translations LocaleTranslations) OptionFn
- func WithDomain(domain string) OptionFn
- func WithLocale(locale string) OptionFn
- func WithLocalizationPath(path string) OptionFn
- func WithTranslations(translations DomainTranslations) OptionFn
- type TranslationFilter
- type Translations
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTranslationFiles ¶
func LoadTranslationFiles(path string, translations DomainTranslations, domain *Domain)
func TranslatorFilter ¶
func TranslatorFilter(options ...OptionFn) factory.AppendFilterFn
TranslatorFilter {{ message|trans(arguments = [], domain = null, locale = null) }}
func WithTranslator ¶
func WithTranslator(translator *Translator) factory.AppendFilterFn
Types ¶
type DomainTranslations ¶
type DomainTranslations map[Domain]LocaleTranslations
type LocaleTranslations ¶
type LocaleTranslations map[Locale]Translations
type Option ¶
type Option struct {
DefaultLocale Locale
DefaultDomain Domain
DomainTranslations DomainTranslations
Translation LocaleTranslations
}
type OptionFn ¶
type OptionFn func(*Option)
func AddDomainTranslations ¶
func WithDefaultDomain ¶
func WithDefaultDomain() OptionFn
func WithDefaultTranslations ¶
func WithDefaultTranslations(translations LocaleTranslations) OptionFn
func WithDomain ¶
func WithLocale ¶
func WithLocalizationPath ¶
func WithTranslations ¶
func WithTranslations(translations DomainTranslations) OptionFn
type TranslationFilter ¶
type TranslationFilter struct {
Translator
}
type Translations ¶
type Translator ¶
type Translator struct {
Domain Domain
Locale Locale
SelectedLocale Locale
Translations map[string]string
LocaleTranslations map[Locale]Translations
DomainTranslations map[Domain]LocaleTranslations
}
func GetTranslator ¶
func GetTranslator(opts ...OptionFn) *Translator
func NewTranslator ¶
func NewTranslator(opts ...OptionFn) *Translator
func (*Translator) GetDomain ¶
func (t *Translator) GetDomain(domain Domain) Domain
func (*Translator) GetLocale ¶
func (t *Translator) GetLocale(locale Locale) Locale
func (*Translator) SetLocale ¶
func (t *Translator) SetLocale(locale Locale)
Click to show internal directories.
Click to hide internal directories.