Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
DefaultDomain = "messages"
)
Default values.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext get language from context or use default.
Types ¶
type Option ¶
type Option func(*Translate)
Option configures translate.
func WithCurrency ¶
func WithCurrency(key string, val interface{}, opts ...arg.CurrencyOption) Option
WithCurrency sets date argument.
func WithNumber ¶
func WithNumber(key string, val interface{}, opts ...arg.NumberOption) Option
WithNumber sets number with options.
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator struct.
func New ¶
func New(locale language.Tag, provider Provider, opts ...TranslatorOption) *Translator
New creates new translator.
func (*Translator) Trans ¶
Trans translates key by options.
Example ¶
Output: Привет Мир! Hello World! Ahoj Svet! שלום עולם Привет Andrey! Вы опоздали на одну минуту. Вы вовремя. Вы опоздали на 101 минуту. Вы опоздали на 123 456,78 минут. Вы опоздали на 50 минут. You are 1 minute late. You are 33 minutes late. В каждом доме есть 1,2 велосипеда. There are 1.2 bikes per household. Это стоит ₽ 12.0101. It costs HK$ 15.
type TranslatorOption ¶
type TranslatorOption func(*Translator)
TranslatorOption options translator.