First commit
This commit is contained in:
101
hGameTest/node_modules/os-locale/index.js
generated
vendored
Normal file
101
hGameTest/node_modules/os-locale/index.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
const execa = require('execa');
|
||||
const lcid = require('lcid');
|
||||
const mem = require('mem');
|
||||
|
||||
const defaultOpts = {spawn: true};
|
||||
const defaultLocale = 'en_US';
|
||||
|
||||
function getEnvLocale(env) {
|
||||
env = env || process.env;
|
||||
return env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
|
||||
}
|
||||
|
||||
function parseLocale(x) {
|
||||
const env = x.split('\n').reduce((env, def) => {
|
||||
def = def.split('=');
|
||||
env[def[0]] = def[1].replace(/^"|"$/g, '');
|
||||
return env;
|
||||
}, {});
|
||||
return getEnvLocale(env);
|
||||
}
|
||||
|
||||
function getLocale(str) {
|
||||
return (str && str.replace(/[.:].*/, ''));
|
||||
}
|
||||
|
||||
function getAppleLocale() {
|
||||
return execa.stdout('defaults', ['read', '-g', 'AppleLocale']);
|
||||
}
|
||||
|
||||
function getAppleLocaleSync() {
|
||||
return execa.sync('defaults', ['read', '-g', 'AppleLocale']).stdout;
|
||||
}
|
||||
|
||||
function getUnixLocale() {
|
||||
if (process.platform === 'darwin') {
|
||||
return getAppleLocale();
|
||||
}
|
||||
|
||||
return execa.stdout('locale')
|
||||
.then(stdout => getLocale(parseLocale(stdout)));
|
||||
}
|
||||
|
||||
function getUnixLocaleSync() {
|
||||
if (process.platform === 'darwin') {
|
||||
return getAppleLocaleSync();
|
||||
}
|
||||
|
||||
return getLocale(parseLocale(execa.sync('locale').stdout));
|
||||
}
|
||||
|
||||
function getWinLocale() {
|
||||
return execa.stdout('wmic', ['os', 'get', 'locale'])
|
||||
.then(stdout => {
|
||||
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
|
||||
return lcid.from(lcidCode);
|
||||
});
|
||||
}
|
||||
|
||||
function getWinLocaleSync() {
|
||||
const stdout = execa.sync('wmic', ['os', 'get', 'locale']).stdout;
|
||||
const lcidCode = parseInt(stdout.replace('Locale', ''), 16);
|
||||
return lcid.from(lcidCode);
|
||||
}
|
||||
|
||||
module.exports = mem(opts => {
|
||||
opts = opts || defaultOpts;
|
||||
const envLocale = getEnvLocale();
|
||||
let thenable;
|
||||
|
||||
if (envLocale || opts.spawn === false) {
|
||||
thenable = Promise.resolve(getLocale(envLocale));
|
||||
} else if (process.platform === 'win32') {
|
||||
thenable = getWinLocale();
|
||||
} else {
|
||||
thenable = getUnixLocale();
|
||||
}
|
||||
|
||||
return thenable.then(locale => locale || defaultLocale)
|
||||
.catch(() => defaultLocale);
|
||||
});
|
||||
|
||||
module.exports.sync = mem(opts => {
|
||||
opts = opts || defaultOpts;
|
||||
const envLocale = getEnvLocale();
|
||||
let res;
|
||||
|
||||
if (envLocale || opts.spawn === false) {
|
||||
res = getLocale(envLocale);
|
||||
} else {
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
res = getWinLocaleSync();
|
||||
} else {
|
||||
res = getUnixLocaleSync();
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
return res || defaultLocale;
|
||||
});
|
||||
21
hGameTest/node_modules/os-locale/license
generated
vendored
Normal file
21
hGameTest/node_modules/os-locale/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
77
hGameTest/node_modules/os-locale/package.json
generated
vendored
Normal file
77
hGameTest/node_modules/os-locale/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_from": "os-locale@^2.0.0",
|
||||
"_id": "os-locale@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==",
|
||||
"_location": "/os-locale",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "os-locale@^2.0.0",
|
||||
"name": "os-locale",
|
||||
"escapedName": "os-locale",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
|
||||
"_shasum": "42bc2900a6b5b8bd17376c8e882b65afccf24bf2",
|
||||
"_spec": "os-locale@^2.0.0",
|
||||
"_where": "/home/andreas/Documents/Projects/haxe/openfl/nigger/node_modules/yargs",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/os-locale/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"execa": "^0.7.0",
|
||||
"lcid": "^1.0.0",
|
||||
"mem": "^1.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the system locale",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"import-fresh": "^2.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/os-locale#readme",
|
||||
"keywords": [
|
||||
"locale",
|
||||
"lang",
|
||||
"language",
|
||||
"system",
|
||||
"os",
|
||||
"string",
|
||||
"str",
|
||||
"user",
|
||||
"country",
|
||||
"id",
|
||||
"identifier",
|
||||
"region"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "os-locale",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/os-locale.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
||||
53
hGameTest/node_modules/os-locale/readme.md
generated
vendored
Normal file
53
hGameTest/node_modules/os-locale/readme.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# os-locale [](https://travis-ci.org/sindresorhus/os-locale)
|
||||
|
||||
> Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software))
|
||||
|
||||
Useful for localizing your module or app.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save os-locale
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const osLocale = require('os-locale');
|
||||
|
||||
osLocale().then(locale => {
|
||||
console.log(locale);
|
||||
//=> 'en_US'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### osLocale([options])
|
||||
|
||||
Returns a `Promise` for the locale.
|
||||
|
||||
### osLocale.sync([options])
|
||||
|
||||
Returns the locale.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### spawn
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Set to `false` to avoid spawning subprocesses and instead only resolve the locale from environment variables.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user