transloco

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog map[string]any

type Config

type Config struct {
	Enabled          bool     `toml:"enabled"`           // Включить поддержку i18n
	DefaultLocale    string   `toml:"default-locale"`    // Локаль по умолчанию
	SupportedLocales []string `toml:"supported-locales"` // Поддерживаемые локали помимо DefaultLocale
	FilesDirectory   string   `toml:"files-directory"`   // Путь к каталогу с файлами переводов
}

func (*Config) Check

func (x *Config) Check(_ any) (err error)

Проверка валидности Config

type I18n

type I18n struct {
	// contains filtered or unexported fields
}

func New

func New(defaultLocale string) *I18n

Новый экземпляр переводчика

func (*I18n) Close

func (i *I18n) Close()

Может пригодится

func (*I18n) Load

func (i *I18n) Load(locale string, file string) error

Загрузка файла с переводами

func (*I18n) LoadAll

func (i *I18n) LoadAll(baseFileName string) error

Загрузка всех доступных файлов с переводами для указанного базового имени

func (*I18n) T

func (i *I18n) T(locale string, key string, args map[string]any) string

Перевод фразы на заданный язык

Jump to

Keyboard shortcuts

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