Documentation
¶
Index ¶
- func GetLocalizer(c *gin.Context) *i18n.Localizer
- func InitLocalization(config config.LocalizationConfig)
- func LoadLocaleFiles(path string) error
- func LocalizationMiddleware() gin.HandlerFunc
- func LocalizeDate(c *gin.Context, year int, month int, day int) string
- func LocalizePlural(c *gin.Context, messageID string, count int) string
- func LocalizePrefixStrings(c *gin.Context, partialID string) map[string]string
- func LocalizeStrings(localizer *i18n.Localizer, messageIDs []string) map[string]string
- type LocalizationData
- type Message
- type SectionData
- type Trie
- type TrieNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalizer ¶
GetLocalizer retrieves the localizer from Gin's context.
func InitLocalization ¶
func InitLocalization(config config.LocalizationConfig)
func LoadLocaleFiles ¶
func LocalizationMiddleware ¶
func LocalizationMiddleware() gin.HandlerFunc
LocalizationMiddleware detects the user's language and initializes a localizer.
func LocalizeDate ¶
LocalizeDate formats a date according to the language in the localizer.
func LocalizePlural ¶
LocalizePlural is a helper function that localizes a message ID with pluralization
func LocalizePrefixStrings ¶
LocalizePrefixStrings Modify the function to use SearchPrefix to find all keys that start with the given prefix, and then localize those strings.
Types ¶
type LocalizationData ¶
type LocalizationData map[string]SectionData
LocalizationData holds all sections with their respective translations
type SectionData ¶
SectionData represents the data of a specific section in your JSON files
Click to show internal directories.
Click to hide internal directories.