Documentation
¶
Index ¶
- func GetDefaultLanguage() language.Tag
- func GetLanguages() []language.Tag
- func GetMessage(id string, tag language.Tag, args []any, count interface{}, fallback string) string
- func Initialize(defaultLanguage language.Tag, filesystem fs.ReadDirFS, directoryPath string) error
- func InitializeMock() error
- type FluentChain
- func (l *FluentChain) Count(count interface{}) *FluentChain
- func (l *FluentChain) Fallback(text string) *FluentChain
- func (l *FluentChain) In(tag language.Tag) *FluentChain
- func (l *FluentChain) Message(id string) *FluentChain
- func (l *FluentChain) Mock(text string) *FluentChain
- func (l *FluentChain) String() string
- func (l *FluentChain) With(args ...any) *FluentChain
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultLanguage ¶
func GetLanguages ¶
func GetMessage ¶
func Initialize ¶
func Initialize( defaultLanguage language.Tag, filesystem fs.ReadDirFS, directoryPath string, ) error
Load localization files from directory specified by the <directoryPath> and prepare them for global usage.
//go:embed locale/*.yml var localeFS embed.FS err := locale.Initialize(languages.English, localeFS, "locale")
func InitializeMock ¶
func InitializeMock() error
Types ¶
type FluentChain ¶
type FluentChain struct {
// contains filtered or unexported fields
}
func Count ¶
func Count(count interface{}) *FluentChain
Constructs an instance of FluentChain and calls Count() on it
func Fallback ¶
func Fallback(text string) *FluentChain
Constructs an instance of FluentChain and calls Count() on it
func In ¶
func In(tag language.Tag) *FluentChain
Constructs an instance of FluentChain and calls In() on it
func Message ¶
func Message(id string) *FluentChain
Constructs an instance of FluentChain and calls Message() on it
func Mock ¶
func Mock(text string) *FluentChain
Constructs an instance of FluentChain and calls Mock() on it
func With ¶
func With(args ...any) *FluentChain
Constructs an instance of FluentChain and calls With() on it
func (*FluentChain) Count ¶
func (l *FluentChain) Count(count interface{}) *FluentChain
Change the plural count for the given fluent call chain
func (*FluentChain) Fallback ¶
func (l *FluentChain) Fallback(text string) *FluentChain
Change the plural count for the given fluent call chain
func (*FluentChain) In ¶
func (l *FluentChain) In(tag language.Tag) *FluentChain
Set the language for the given fluent call chain
func (*FluentChain) Message ¶
func (l *FluentChain) Message(id string) *FluentChain
Set the message id as specified in the file
func (*FluentChain) Mock ¶
func (l *FluentChain) Mock(text string) *FluentChain
Change the plural count for the given fluent call chain
func (*FluentChain) String ¶
func (l *FluentChain) String() string
func (*FluentChain) With ¶
func (l *FluentChain) With(args ...any) *FluentChain
Change the template arguments for the given fluent call chain