Documentation ¶
Overview ¶
Package l18n handles everything language-related for Mycorrhiza.
Index ¶
- type Localizer
- func (t Localizer) Get(key string, replacements ...*Replacements) string
- func (t Localizer) GetPlural(key string, n int, replacements ...*Replacements) string
- func (t Localizer) GetPlural64(key string, n int64, replacements ...*Replacements) string
- func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string
- type Replacements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Localizer ¶
func FromRequest ¶
FromRequest takes a HTTP request and picks the most appropriate localizer with English as the fallback language.
func (Localizer) Get ¶
func (t Localizer) Get(key string, replacements ...*Replacements) string
Get returns a localized string for the provided key with optional replacements executed on the string.
func (Localizer) GetPlural ¶
func (t Localizer) GetPlural(key string, n int, replacements ...*Replacements) string
GetPlural returns a localized string respecting locale-specific plural rules. Technically, it replaces %s token with +form subkey and proceeds as usual.
func (Localizer) GetPlural64 ¶
func (t Localizer) GetPlural64(key string, n int64, replacements ...*Replacements) string
GetPlural64 is ditto for int64
func (Localizer) GetWithLocale ¶
func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string
GetWithLocale returns a localized string for the provided key in a specific locale with optional replacements executed on the string.
type Replacements ¶
type Replacements map[string]interface{}
Click to show internal directories.
Click to hide internal directories.