i18n

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package i18n renders API-owned messages from the backend translation catalog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

FromContext returns the request locale, or English for background work.

func Locale

func Locale(header string, additional ...string) string

Locale selects a catalog or additional locale with a positive Accept-Language weight.

func Locales

func Locales(key string) map[string]string

Locales returns a rendered value for each non-English locale.

func Message

func Message(locale, key string, args map[string]string) string

Message renders a catalog key. A missing translation falls back to English.

func Resolve

func Resolve(locale, value string) string

Resolve substitutes catalog references in provider display text once. Missing or empty translations fall back to English; unknown references remain unchanged.

func Text

func Text(locale, key string) string

Text returns a catalog message without arguments.

func WithLocale

func WithLocale(ctx context.Context, locale string) context.Context

WithLocale carries a request's selected locale into API services.

Types

This section is empty.

Jump to

Keyboard shortcuts

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