Skip to content

Repository files navigation

Windows Locale

Node Version Downloads

Windows Language Code Identifier (LCID) for JavaScript

Installation

Module available through the npm registry. It can be installed using the npm or yarn command line tools.

# NPM
npm install windows-locale --save
# Or Using Yarn
yarn add windows-locale

Example

import locale from 'windows-locale'
// Or using the named export
import { locales } from 'windows-locale'

console.log(locale['pt-br'])
/*
{
	language: 'Portuguese',
	location: 'Brazil',
	id: 1046,
	tag: 'pt-BR',
	version: 'Release A'
}
*/

CommonJS is still supported. const locale = require('windows-locale') keeps working and returns the same data.

TypeScript types are bundled, the keys are checked at compile time:

import locale from 'windows-locale'

locale['pt-br'].language // string
locale['unknown'] // Type error

Documentation

locale

List of Languages

locale[language]

Get Windows Language Code Identifier (LCID) information

  • language (String)
  • location (String || Null)
  • id (Number)
  • tag (String)
  • version (String)

Source

NOTE: Data is generated from the Microsoft [MS-LCID]: Windows Language Code Identifier (LCID) Reference specification, revision 16.0 (2024-04-23).

To regenerate index.json, index.d.ts, index.d.mts and index.mjs, download the PDF above as [MS-LCID].pdf into the repository root and run:

yarn build

Dependencies

None

Dev Dependencies

  • pdf2json: A PDF file parser that converts PDF binaries to text based JSON, powered by porting a fork of PDF.JS to Node.js
  • standard: JavaScript Standard Style

Contributors

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. List of all contributors.

License

MIT © Tiago Danin

About

Windows Language Code Identifier (LCID) for JavaScript

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages