Documentation
¶
Index ¶
- func Clear()
- func Format(locale, format string, args ...any) string
- func Get(locale, section, name string) (string, bool)
- func GetBundle(locale string) *ini.Ini
- func Load(root string) error
- func LoadFS(fsys fs.FS, root string) error
- func SetDefault(tbs *TextBundles)
- type TextBundles
- func (tbs *TextBundles) Clear()
- func (tbs *TextBundles) Format(locale, format string, args ...any) string
- func (tbs *TextBundles) Get(locale, section, name string) (string, bool)
- func (tbs *TextBundles) GetBundle(locale string) *ini.Ini
- func (tbs *TextBundles) Load(root string) error
- func (tbs *TextBundles) LoadFS(fsys fs.FS, root string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(tbs *TextBundles)
SetDefault set the default TextBundles instance used by the package-level functions.
Types ¶
type TextBundles ¶
type TextBundles struct {
Extensions []string // file extensions
Timestamp time.Time // modified timestamp
// contains filtered or unexported fields
}
TextBundles a localized text resource bundle container
func Default ¶
func Default() *TextBundles
Default returns the default TextBundles instance used by the package-level functions.
func NewTextBundles ¶
func NewTextBundles(extensions ...string) *TextBundles
NewTextBundles returns a new TextBundles instance
func (*TextBundles) Format ¶
func (tbs *TextBundles) Format(locale, format string, args ...any) string
Format translate content to target language.
func (*TextBundles) Get ¶
func (tbs *TextBundles) Get(locale, section, name string) (string, bool)
Get target locale string
func (*TextBundles) GetBundle ¶
func (tbs *TextBundles) GetBundle(locale string) *ini.Ini
GetBundle get target locale ini bundle
func (*TextBundles) Load ¶
func (tbs *TextBundles) Load(root string) error
Load glob and parse text files under root path
Click to show internal directories.
Click to hide internal directories.