i18n

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnglishLanguage = "en"
	SpanishLanguage = "es"
	DefaultLanguage = EnglishLanguage
)

Variables

This section is empty.

Functions

func IsSupportedLanguage

func IsSupportedLanguage(code string) bool

IsSupportedLanguage returns whether the language code is supported.

func NormalizeLanguageCode

func NormalizeLanguageCode(code string) string

NormalizeLanguageCode canonicalizes the user language input.

func SupportedLanguages

func SupportedLanguages() []string

SupportedLanguages returns a copy of all supported language codes.

func SupportedLanguagesDescription

func SupportedLanguagesDescription() string

SupportedLanguagesDescription returns a stable human-readable language list.

func ValidateCustomCatalog

func ValidateCustomCatalog(path string) error

ValidateCustomCatalog validates a custom YAML catalog file.

func ValidateLanguage

func ValidateLanguage(code string) error

ValidateLanguage returns an error if the language is not supported.

Types

type Translator

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

Translator contains localized strings for comment rendering.

func NewTranslator

func NewTranslator(config TranslatorConfig) (*Translator, error)

NewTranslator creates a translator from a built-in language plus optional custom YAML overrides.

func NewTranslatorOrDefault

func NewTranslatorOrDefault(config TranslatorConfig) *Translator

NewTranslatorOrDefault creates a translator or falls back to English.

func (*Translator) CommandTitle

func (t *Translator) CommandTitle(commandName string) string

CommandTitle returns the display title for a command name.

func (*Translator) LanguageCode

func (t *Translator) LanguageCode() string

LanguageCode returns the normalized language code.

func (*Translator) MergeRequestLabel

func (t *Translator) MergeRequestLabel() string

MergeRequestLabel returns a localized merge request label.

func (*Translator) PullRequestLabel

func (t *Translator) PullRequestLabel() string

PullRequestLabel returns a localized pull request label.

type TranslatorConfig

type TranslatorConfig struct {
	LanguageCode string
	CatalogPath  string
}

TranslatorConfig configures translation loading.

Jump to

Keyboard shortcuts

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