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
- func GetSupportedLanguages() []string
- type Localizer
- func (t Localizer) Get(key string, replacements ...*Replacements) string
- func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string
- func (t Localizer) SetFallbackLocale(fallback string) Localizer
- func (t Localizer) SetLocale(locale string) Localizer
- func (t Localizer) SetLocales(locale, fallback string) Localizer
- type Replacements
Constants ¶
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 ¶
func (Localizer) GetWithLocale ¶
func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string
func (Localizer) SetFallbackLocale ¶
func (Localizer) SetLocales ¶
type Replacements ¶
type Replacements map[string]interface{}