UNPKG

1.57 kBTypeScriptView Raw
1// import lcidCodes from './lcid.json'; // TODO: Use `with` here when TypeScript supports it.
2
3declare const lcid: {
4 /**
5 Get a [standard locale identifier](https://en.wikipedia.org/wiki/Locale_(computer_software)) from a [Windows locale identifier (LCID)](https://en.wikipedia.org/wiki/Locale#Specifics_for_Microsoft_platforms).
6
7 @example
8 ```
9 import lcid from 'lcid';
10
11 lcid.from(1044);
12 //=> 'nb_NO'
13 ```
14 */
15 from(lcidCode: number): string | undefined;
16
17 /**
18 Get a [standard locale identifier](https://en.wikipedia.org/wiki/Locale_(computer_software)) from a [Windows locale identifier (LCID)](https://en.wikipedia.org/wiki/Locale#Specifics_for_Microsoft_platforms).
19
20 @example
21 ```
22 import lcid from 'lcid';
23
24 lcid.from(1044);
25 //=> 'nb_NO'
26 ```
27 */
28 // from(lcidCode: keyof typeof lcidCodes): string;
29
30 /**
31 Get a [Windows locale identifier (LCID)](https://en.wikipedia.org/wiki/Locale#Specifics_for_Microsoft_platforms) from a [standard locale identifier](https://en.wikipedia.org/wiki/Locale_(computer_software)).
32
33 @example
34 ```
35 import lcid from 'lcid';
36
37 lcid.to('nb_NO');
38 //=> 1044
39 ```
40 */
41 to(localeId: string): number | undefined;
42
43 /**
44 Mapping between [standard locale identifiers](https://en.wikipedia.org/wiki/Locale_(computer_software)) and [Windows locale identifiers (LCID)](https://en.wikipedia.org/wiki/Locale#Specifics_for_Microsoft_platforms).
45
46 @example
47 ```
48 import lcid from 'lcid';
49
50 lcid.all;
51 //=> {'af_ZA': 1078, …}
52 ```
53 */
54 readonly all: Record<string, number>;
55 // TODO: readonly all: typeof lcidCodes;
56};
57
58export default lcid;