A lightweight, strongly typed localization data library for countries, currencies, languages, and timezones.
npm install @oglofus/localizationpnpm add @oglofus/localizationyarn add @oglofus/localizationbun add @oglofus/localizationimport {
countries,
countries_map,
currencies,
languages,
timezones,
country_alpha2_values,
country_alpha3_values,
currency_codes,
language_alpha2_values,
language_alpha3_values,
language_alpha2_to_alpha3,
language_alpha3_to_alpha2,
timezones_identifiers,
} from "@oglofus/localization";
const us = countries.find((country) => country.alpha2 === "US");
const usd = currencies.find((currency) => currency.code === "USD");
const french = languages.find((language) => language.alpha2 === "fr");
const parisTz = timezones.find((tz) => tz.identifier === "Europe/Paris");
const usEmoji = countries_map.US.emoji; // "🇺🇸"
const alpha3 = language_alpha2_to_alpha3.en; // "eng"All datasets are readonly arrays with strongly typed values.
countries: list of countries with ISO codes, calling codes, currencies, languages, emoji, and timezones.countries_map: quick lookup map of country name + emoji keyed by alpha-2 code.currencies: list of currencies with ISO code, name, number, and decimal precision.languages: list of languages with ISO alpha-2/alpha-3 codes and bibliographic codes.timezones: list of timezone identifiers mapped to associated country alpha-2 codes.
Each code list is exported as a readonly array plus a union type.
country_alpha2_values,CountryAlpha2country_alpha3_values,CountryAlpha3currency_codes,CurrencyCodelanguage_alpha2_values,LanguageAlpha2language_alpha3_values,LanguageAlpha3timezones_identifiers,TimezoneIdentifier
language_alpha2_to_alpha3: map from alpha-2 to alpha-3 language codes.language_alpha3_to_alpha2: map from alpha-3 to alpha-2 language codes.
This package ships as ESM and includes TypeScript declarations out of the box.
- Build:
npm run build(outputs todist/) - TypeScript config:
tsconfig.json
ISC License. See the LICENSE file for details.