locales

package
v0.0.0-...-60192f8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package locales provides l10n tools to render gettext text.

Translations are in the "translations" embedded folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() [][2]string

Available returns the available locales as a list of pair containing the langage code and its localized name.

func Load

func Load()

Load loads all the available translations.

Types

type Locale

type Locale struct {
	Translator gotext.Translator
	Tag        language.Tag
}

Locale combines a gotext.Translator instance for a given language identified by a language.Tag.

func LoadTranslation

func LoadTranslation(lang string) *Locale

LoadTranslation loads the best match translation for a given locale code.

func (*Locale) Gettext

func (t *Locale) Gettext(str string, vars ...interface{}) string

Gettext returns a translation.

func (*Locale) Ngettext

func (t *Locale) Ngettext(str, plural string, n int, vars ...interface{}) string

Ngettext returns a pluralized translation.

func (*Locale) Npgettext

func (t *Locale) Npgettext(ctx, str, plural string, n int, vars ...interface{}) string

Npgettext returns a pluralized contextualized translation.

func (*Locale) Pgettext

func (t *Locale) Pgettext(ctx, str string, vars ...interface{}) string

Pgettext returns a contextualized translation.

Jump to

Keyboard shortcuts

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