@worldkit/languages
v1.0.3
Published
Modular language data and lookup functions
Maintainers
Readme
🗣️ @worldkit/languages
Fast ISO 639-1 languages dataset for JavaScript & TypeScript.
Lookup 180+ ISO 639-1 languages, native language names, and country-to-language mappings.
📚 Full Documentation: https://worldkit.in/docs/languages
⚡ Features
- 🌐 180+ ISO 639-1 Languages: English, French, Hindi, Japanese, Spanish, Arabic, German, and more.
- 💬 Native Language Names: Provides localized names (e.g.
"ja"->"日本語","hi"->"हिन्दी"). - 🗺️ Country Language Lookup: Instantly fetch official languages spoken in any country.
- 📦 Micro Footprint: ~1.1 KB gzipped.
📦 Install
npm install @worldkit/languages
# or
pnpm add @worldkit/languages
# or
yarn add @worldkit/languages💡 Usage
import { language, languages } from "@worldkit/languages";
// 1. Get Language Details by ISO 639-1 Code
const french = language("fr");
console.log(french);
/*
{
code: "fr",
name: "French",
nativeName: "Français"
}
*/
const japanese = language("ja");
console.log(japanese?.nativeName); // "日本語"
// 2. Get Spoken Languages for a Country
const canadaLangs = languages("CA");
console.log(canadaLangs); // ["en", "fr"]
const switzerlandLangs = languages("CH");
console.log(switzerlandLangs); // ["de", "fr", "it", "rm"]📖 API Reference
language(code: string): Language | undefined
Look up language metadata by 2-letter ISO 639-1 code (e.g. "en", "fr", "hi").
languages(countryIso2: string): string[]
Returns array of 2-letter language codes officially spoken in that country.
📐 TypeScript Support
Includes strict TypeScript definitions:
import type { Language } from "@worldkit/languages";🔗 Related Packages
Explore the rest of the WorldKit ecosystem:
@worldkit/core- Unified global data facade.@worldkit/countries- 250+ country dataset.@worldkit/search- Fast search engine across languages.
📜 License
MIT © WorldKit
