Translations

Translations

All entity names (countries, languages, currencies, continents, and capitals) can be retrieved in multiple languages.

Available Locales

CodeLanguage
daDanish
deGerman
enEnglish
esSpanish
frFrench
itItalian
zhChinese

Country Names

GoDartTypeScriptphp
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) // Francia

Language Names

GoDartTypeScriptphp
name, ok := i18n.GetLanguagesName("en", "fr")
if ok {
    fmt.Println(name) // anglais
}

Currency Names

GoDartTypeScriptphp
name, ok := i18n.GetCurrenciesName("USD", "it")
if ok {
    fmt.Println(name) // Dollaro statunitense
}

Continent Names

GoDartTypeScriptphp
name, ok := i18n.GetContinentsName("EU", "da")
if ok {
    fmt.Println(name) // Europa
}

Capital Names

GoDartTypeScriptphp
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.

GoDartTypeScriptphp
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