- Home
- Packages
- Go
- infobits-intl
- Documentation
- Translations
Translations
Translations
All entity names (countries, languages, currencies, continents, and capitals) can be retrieved in multiple languages.
Available Locales
| Code | Language |
|---|---|
da | Danish |
de | German |
en | English |
es | Spanish |
fr | French |
it | Italian |
zh | Chinese |
Country Names
import "github.com/infobits-io/infobits-intl-go/i18n"
name, ok := i18n.GetCountriesName("US", "de")
if ok {
fmt.Println(name) // Vereinigte Staaten
}
name, _ = i18n.GetCountriesName("FR", "es")
fmt.Println(name) // FranciaLanguage Names
name, ok := i18n.GetLanguagesName("en", "fr")
if ok {
fmt.Println(name) // anglais
}Currency Names
name, ok := i18n.GetCurrenciesName("USD", "it")
if ok {
fmt.Println(name) // Dollaro statunitense
}Continent Names
name, ok := i18n.GetContinentsName("EU", "da")
if ok {
fmt.Println(name) // Europa
}Capital Names
name, ok := i18n.GetCapitalsName("JP", "fr")
if ok {
fmt.Println(name) // Tokyo
}Accessing Translation Maps Directly
For bulk operations, you can access the full translation maps.
import "github.com/infobits-io/infobits-intl-go/i18n"
// Access all German country translations
germanCountries := i18n.CountriesTranslations["de"]
for code, name := range germanCountries {
fmt.Printf("%s: %s\n", code, name)
}
// Other available maps:
// i18n.LanguagesTranslations
// i18n.CurrenciesTranslations
// i18n.ContinentsTranslations
// i18n.CapitalsTranslations