Projekt

Obecné

Profil

Stáhnout (1.65 KB) Statistiky
| Větev: | Revize:
1
# os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](https://travis-ci.org/sindresorhus/os-locale)
2

    
3
> Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software))
4

    
5
Useful for localizing your module or app.
6

    
7
POSIX systems: The returned locale refers to the [`LC_MESSAGE`](http://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html#Locale-Categories) category, suitable for selecting the language used in the user interface for message translation.
8

    
9
---
10

    
11
<div align="center">
12
	<b>
13
		<a href="https://tidelift.com/subscription/pkg/npm-os-locale?utm_source=npm-os-locale&utm_medium=referral&utm_campaign=readme">Get professional support for 'os-locale' with a Tidelift subscription</a>
14
	</b>
15
	<br>
16
	<sub>
17
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
18
	</sub>
19
</div>
20

    
21
---
22

    
23
## Install
24

    
25
```
26
$ npm install os-locale
27
```
28

    
29

    
30
## Usage
31

    
32
```js
33
const osLocale = require('os-locale');
34

    
35
(async () => {
36
	console.log(await osLocale());
37
	//=> 'en_US'
38
})();
39
```
40

    
41

    
42
## API
43

    
44
### osLocale([options])
45

    
46
Returns a `Promise` for the locale.
47

    
48
### osLocale.sync([options])
49

    
50
Returns the locale.
51

    
52
#### options
53

    
54
Type: `Object`
55

    
56
##### spawn
57

    
58
Type: `boolean`<br>
59
Default: `true`
60

    
61
Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
62

    
63

    
64
## Security
65

    
66
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
67

    
68

    
69
## License
70

    
71
MIT © [Sindre Sorhus](https://sindresorhus.com)
(4-4/4)