translate

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 9 Imported by: 0

README

translate

简单包装了一下go-i18n库,针对自身需求,简化了接口调用

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IllegalFilename added in v0.0.2

type IllegalFilename struct {
	// contains filtered or unexported fields
}

func (IllegalFilename) Error added in v0.0.2

func (e IllegalFilename) Error() string

type LocaleNotSet added in v0.1.0

type LocaleNotSet struct {
	// contains filtered or unexported fields
}

func (LocaleNotSet) Error added in v0.1.0

func (e LocaleNotSet) Error() string

type Locales added in v0.1.0

type Locales struct {
	// contains filtered or unexported fields
}

func NewLocales added in v0.1.0

func NewLocales(localeFilenamePrefix string, defaultLanguage string) (*Locales, error)

func NewLocalesWith added in v0.1.1

func NewLocalesWith(localeFilenamePrefix string, fsys fs.FS, initialLocaleFile string) (*Locales, error)

func (*Locales) ClearFallbackLocal added in v0.1.2

func (l *Locales) ClearFallbackLocal()

func (*Locales) CurrentLocale added in v0.1.2

func (l *Locales) CurrentLocale() (tagName string)

func (*Locales) DisplayNameOf added in v0.1.0

func (l *Locales) DisplayNameOf(tagName string) (displayName string, err error)

func (*Locales) FallbackLocale added in v0.1.2

func (l *Locales) FallbackLocale() (tagName string)

func (*Locales) GetLocaleNames added in v0.1.0

func (l *Locales) GetLocaleNames() (displayNames []string)

func (*Locales) GetLocales added in v0.1.0

func (l *Locales) GetLocales() (tagNames []string)

func (*Locales) LoadLocaleFile added in v0.1.0

func (l *Locales) LoadLocaleFile(fsys fs.FS, path string) (displayName, tagName string, err error)

func (*Locales) LoadLocalesDir added in v0.1.0

func (l *Locales) LoadLocalesDir(dir string) (success []string, fail []string, err error)

func (*Locales) Localize added in v0.1.0

func (l *Locales) Localize(config *i18n.LocalizeConfig) (string, error)

func (*Locales) MustTr added in v0.1.1

func (l *Locales) MustTr(id string, fallback string) string

func (*Locales) SetFallbackLocale added in v0.1.2

func (l *Locales) SetFallbackLocale(tagName string) (displayName string, err error)

func (*Locales) SetLocale added in v0.1.2

func (l *Locales) SetLocale(tagName string) (displayName string, err error)

func (*Locales) SetLocaleByDisplayName added in v0.1.2

func (l *Locales) SetLocaleByDisplayName(displayName string) (tagName string, err error)

func (*Locales) TagNameOf added in v0.1.0

func (l *Locales) TagNameOf(displayName string) (tagName string, err error)

func (*Locales) Tr added in v0.1.0

func (l *Locales) Tr(id string) (string, error)

type MissingDisplayName added in v0.1.0

type MissingDisplayName struct {
	// contains filtered or unexported fields
}

func (MissingDisplayName) Error added in v0.1.0

func (e MissingDisplayName) Error() string

type NotLoaded added in v0.1.0

type NotLoaded struct {
	// contains filtered or unexported fields
}

func (NotLoaded) Error added in v0.1.0

func (e NotLoaded) Error() string

Jump to

Keyboard shortcuts

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