localizations

package
v1.18.4 Latest Latest
Warning

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

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

Documentation

Overview

Package localizations provides localized messages for breaking change and changelog output.

Overview

This package contains all localized message templates used by the checker package to generate human-readable change descriptions. Messages are keyed by rule ID and support multiple languages.

Generated Code

The localizations.go file is auto-generated by go-localize from YAML source files:

//go:generate go-localize -input localizations_src -output localizations

Source files are located in checker/localizations_src/{language}/messages.yaml. Do not edit localizations.go directly - modify the source YAML files instead.

Supported Languages

  • en: English (default)
  • es: Spanish
  • pt-br: Brazilian Portuguese
  • ru: Russian

Use GetSupportedLanguages() to get the list of available languages.

Message Format

Messages use printf-style placeholders (%s, %v, %d) for dynamic values:

"request-property-pattern-added": "added pattern %s to property %s"

Each message ID also has a "-description" variant for short summaries:

"request-property-pattern-added-description": "pattern added to request property"

Usage

Messages are accessed through the Localizer type in the checker package:

localizer := checker.NewLocalizer("en")
message := localizer.Get("request-property-pattern-added")

Index

Constants

View Source
const (
	LangDefault = LangEn
	LangEn      = "en"
	LangRu      = "ru"
	LangPtBr    = "pt-br"
	LangEs      = "es"
)

Variables

This section is empty.

Functions

func GetSupportedLanguages

func GetSupportedLanguages() []string

Types

type Localizer

type Localizer struct {
	Locale         string
	FallbackLocale string
	Localizations  map[string]string
}

func New

func New(locale string, fallbackLocale string) *Localizer

func (Localizer) Get

func (t Localizer) Get(key string, replacements ...*Replacements) string

func (Localizer) GetWithLocale

func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string

func (Localizer) SetFallbackLocale

func (t Localizer) SetFallbackLocale(fallback string) Localizer

func (Localizer) SetLocale

func (t Localizer) SetLocale(locale string) Localizer

func (Localizer) SetLocales

func (t Localizer) SetLocales(locale, fallback string) Localizer

type Replacements

type Replacements map[string]interface{}

Jump to

Keyboard shortcuts

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