Categorygithub.com/nimbusec-oss/go-i18n
modulepackage
2.0.0+incompatible
Repository: https://github.com/nimbusec-oss/go-i18n.git
Documentation: pkg.go.dev

# README

Go-I18N

MIT License Go Doc

Overview

Go-i18n is a internationalization library for golang using the i18next json format.

Features

  • named intermediates

Installation

To install this package, run:

go get github.com/nimbusec-oss/go-i18n

Documentation

Load translations

t, err := i18n.NewTranslations("<dir>", "en").Load()

Add to FuncMap

template.FuncMap{"T":t.GenerateDefaultTranslate(),}

Use in template

{{ T "<translationKey>" }}

# Functions

NewTranslations initializes a new translations object.

# Constants

Prefix marks the begin of a placeholder being used for i18n interpolation.
Suffix marks the end of a placeholder being used for i18n interpolation.

# Structs

Translation defines the translated message for a given key which contains context-dependent intermediates as placeholder.
Translations are a collection of language translations represented by key value structure Upon translating it will attempt to retrieve the target language from a given source function, rolling back to the default language on failure.

# Type aliases

Intermediate is a named placeholder within a translation which may be replaced by a context-dependent value.
Key is a unique identifier for a translation.
Language is the code abbreviation of language.
Store is a map where a key maps to a translation.