i18n

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package i18n provides internationalization support for YAP.

Package i18n provides internationalization support for YAP.

Index

Constants

This section is empty.

Variables

View Source
var SupportedLanguages = []string{"en", "it"}

SupportedLanguages lists all supported language codes.

Functions

func CheckIntegrity

func CheckIntegrity() error

CheckIntegrity verifies the integrity of all locale files. It checks for: 1. Consistent message IDs across all locales 2. Proper YAML formatting 3. No duplicate message IDs 4. Required message IDs present

func GetMessageIDs

func GetMessageIDs() ([]string, error)

GetMessageIDs returns all message IDs used in the application.

func Init

func Init(lang string) error

Init initializes the i18n system with the given language preference. If lang is empty, it will try to detect the system language.

func T

func T(messageID string, templateData ...map[string]any) string

T translates a message using the provided ID and optional template data.

Types

type Message

type Message struct {
	ID          string `yaml:"id"`
	Translation string `yaml:"translation"`
}

Message represents a single translation message.

Jump to

Keyboard shortcuts

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