Documentation
¶
Index ¶
- func ContextWithLocalizer(parent context.Context, l *i18n.Localizer) context.Context
- func EncodeDuration(d time.Duration) string
- func IsLanguageRightToLeft(t language.Tag) bool
- func IsValidLanguageTag(t language.Tag) bool
- func LocalizeError(err error, lc *i18n.Localizer) string
- func LocalizerFromContext(ctx context.Context) (l *i18n.Localizer, ok bool)
- func ParseDuration(s string) (time.Duration, error)
- type Localizable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLocalizer ¶
ContextWithLocalizer adds localizer into context as a value. Use LocalizerFromContext to recover it later.
func EncodeDuration ¶ added in v0.2.1
EncodeDuration returns a string representing the duration in the form "1w4d2h3m5s". Units with 0 values aren't returned, for example: 1d1ms is 1 day 1 milliseconds
func IsLanguageRightToLeft ¶ added in v0.3.5
func IsValidLanguageTag ¶ added in v0.2.1
func LocalizerFromContext ¶
LocalizerFromContext raises request-scoped localizer from context. Returns `<nil>, false` if there is no localizer in context.
func ParseDuration ¶ added in v0.2.1
ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".