- Home
- Packages
- TypeScript
- 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 { getCountriesName } from 'infobits-intl';
const name = getCountriesName('US', 'de');
console.log(name); // Vereinigte Staaten
const nameFr = getCountriesName('FR', 'es');
console.log(nameFr); // FranciaLanguage Names
import { getLanguagesName } from 'infobits-intl';
const name = getLanguagesName('en', 'fr');
console.log(name); // anglaisCurrency Names
import { getCurrenciesName } from 'infobits-intl';
const name = getCurrenciesName('USD', 'it');
console.log(name); // Dollaro statunitenseContinent Names
import { getContinentsName } from 'infobits-intl';
const name = getContinentsName('EU', 'da');
console.log(name); // EuropaCapital Names
import { getCapitalsName } from 'infobits-intl';
const name = getCapitalsName('JP', 'fr');
console.log(name); // TokyoAccessing Translation Maps Directly
For bulk operations, you can access the full translation maps.
import {
countriesTranslations,
languagesTranslations,
currenciesTranslations,
continentsTranslations,
capitalsTranslations
} from 'infobits-intl';
// Access all German country translations
const germanCountries = countriesTranslations['de'];
for (const [code, name] of Object.entries(germanCountries)) {
console.log(`${code}: ${name}`);
}