Documentation ¶
Overview ¶
Package i18n wraps around github.com/nicksnyder/go-i18n mostly so that we don't have to deal with i18n.LocalizeConfig struct literals everywhere.
Index ¶
- Constants
- Variables
- type Helper
- type Localizer
- func (l Localizer) LocalizePlurals(messageID string, pluralCount int) template.HTML
- func (l Localizer) LocalizePluralsWithData(messageID string, pluralCount int, tplData map[string]string) template.HTML
- func (l Localizer) LocalizeSimple(messageID string) template.HTML
- func (l Localizer) LocalizeWithData(messageID string, labelsAndData ...string) template.HTML
- type TagTranslation
Constants ¶
const LanguageCookieName = "gossbroom-language"
Variables ¶
var Defaults fs.FS
Defaults is an embedded filesystem containing translation defaults.
Functions ¶
This section is empty.
Types ¶
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
func (Helper) ChooseTranslation ¶
func (Helper) FromRequest ¶
FromRequest returns a new Localizer for the passed helper, using form value 'lang' and Accept-Language http header from the passed request. If a language cookie is detected, then it takes precedence over the form value & Accept-Lanuage header.
func (Helper) GetRenderFuncs ¶
func (Helper) ListLanguages ¶
func (h Helper) ListLanguages() []TagTranslation
ListLanguages returns a slice of the room's translated languages. The entries of the slice are of the type TagTranslation, consisting of the fields Tag and Translation. Each Tag fields is a language tag (as strings), and the field Translation is the corresponding translated language name of that language tag. Example: {Tag: en, Translation: English}, {Tag: sv, Translation: Svenska} {Tag: de, Translation: Deutsch}
type Localizer ¶
type Localizer struct {
// contains filtered or unexported fields
}