UNPKG

751 BTypeScriptView Raw
1export interface Options {
2 /**
3 Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
4
5 @default true
6 */
7 readonly spawn?: boolean;
8}
9
10/**
11Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)).
12
13@returns The locale.
14
15@example
16```
17import {osLocale} from 'os-locale';
18
19console.log(await osLocale());
20//=> 'en-US'
21```
22*/
23export function osLocale(options?: Options): Promise<string>;
24
25/**
26Synchronously get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)).
27
28@returns The locale.
29
30@example
31```
32import {osLocaleSync} from 'os-locale';
33
34console.log(osLocaleSync());
35//=> 'en-US'
36```
37*/
38export function osLocaleSync(options?: Options): string;