- Home
- Packages
- Dart
- 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
final country = Country.fromAlpha2Code('US');
// Using a Locale object
final name = country?.displayNameFromLocale(Locale('de'));
print(name); // Vereinigte Staaten
// Using BuildContext (in a widget)
final contextName = country?.displayName(context);Language Names
final lang = Language.fromCode('en');
final name = lang?.displayNameFromLocale(Locale('fr'));
print(name); // anglaisCurrency Names
final currency = Currency.fromCode('USD');
final name = currency?.displayNameFromLocale(Locale('it'));
print(name); // Dollaro statunitenseContinent Names
final continent = Continent.fromCode('EU');
final name = continent?.displayNameFromLocale(Locale('da'));
print(name); // EuropaCapital Names
final country = Country.fromAlpha2Code('JP');
final name = country?.displayCapitalFromLocale(Locale('fr'));
print(name); // TokyoAccessing Translation Maps Directly
For bulk operations, you can access the full translation maps.
// Translation maps are accessible via delegate classes
final germanCountries = CountriesTranslationsDelegate.translations['de'];
germanCountries?.forEach((code, name) {
print('$code: $name');
});
// Other available delegates:
// LanguagesTranslationsDelegate.translations
// CurrenciesTranslationsDelegate.translations
// ContinentsTranslationsDelegate.translations
// CapitalsTranslationsDelegate.translations