The `iso639-codes` package provides a comprehensive, static dataset of ISO639 language codes, mapping human-readable language names to their corresponding ISO639-1 (alpha-2) and ISO639-2 (alpha-3) codes, alongside a list of alternative names for each language. The current stable version is 1.0.1, indicating a mature and stable dataset. The package operates on a data-driven release cadence, likely receiving updates primarily when the underlying ISO standard data source (www.loc.gov/standards/iso639-2) changes, or for minor maintenance. Its key differentiator is its direct, pre-parsed JSON structure, which allows for straightforward integration and fast local lookups of language metadata, making it suitable for internationalization (i18n) efforts requiring efficient access to language identifier information without external API calls.
npm install iso639-codesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the ISO639 language codes dataset and access specific language information by name, including ISO639-1, ISO639-2 codes, and alternative names. It also shows how to iterate through the available languages.
Ensure the language name matches the key exactly, as found in the dataset (e.g., by inspecting `Object.keys(iso)`). Example: `iso['Portuguese']` is correct, `iso['portuguese']` is not.
Always check for `null` or `undefined` when accessing `iso639-1` (e.g., `language['iso639-1'] ?? 'N/A'`) if the code is optional for your use case.
Monitor the package's GitHub repository for updates and ensure your dependencies are kept up-to-date to receive the latest available language data.
Ensure the language name matches a key in the `iso` object exactly. Keys are case-sensitive. You can inspect `Object.keys(iso)` to see available language names. Example: `iso['Portuguese']`.
Use a default import statement: `import iso from 'iso639-codes';`
Ensure `const iso = require('iso639-codes');` (for CommonJS) or `import iso from 'iso639-codes';` (for ESM) is at the top of your file before `iso` is referenced.No dependency data recorded yet.