-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocale.ts
More file actions
63 lines (59 loc) · 1.42 KB
/
locale.ts
File metadata and controls
63 lines (59 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* @fileoverview Locale and language environment variable getters.
* Provides access to system locale settings.
*/
import { getEnvValue } from './rewire'
/**
* LANG environment variable.
* System locale and language settings.
*
* @returns The system locale string, or `undefined` if not set
*
* @example
* ```typescript
* import { getLang } from '@socketsecurity/lib/env/locale'
*
* const lang = getLang()
* // e.g. 'en_US.UTF-8' or undefined
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getLang(): string | undefined {
return getEnvValue('LANG')
}
/**
* LC_ALL environment variable.
* Override for all locale settings.
*
* @returns The locale override string, or `undefined` if not set
*
* @example
* ```typescript
* import { getLcAll } from '@socketsecurity/lib/env/locale'
*
* const lcAll = getLcAll()
* // e.g. 'C' or 'en_US.UTF-8'
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getLcAll(): string | undefined {
return getEnvValue('LC_ALL')
}
/**
* LC_MESSAGES environment variable.
* Locale setting for message translations.
*
* @returns The messages locale string, or `undefined` if not set
*
* @example
* ```typescript
* import { getLcMessages } from '@socketsecurity/lib/env/locale'
*
* const lcMessages = getLcMessages()
* // e.g. 'en_US.UTF-8' or undefined
* ```
*/
/*@__NO_SIDE_EFFECTS__*/
export function getLcMessages(): string | undefined {
return getEnvValue('LC_MESSAGES')
}