aboutsummaryrefslogtreecommitdiff
path: root/node_modules/os-locale
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/os-locale')
-rw-r--r--node_modules/os-locale/index.js101
-rw-r--r--node_modules/os-locale/license21
-rw-r--r--node_modules/os-locale/package.json45
-rw-r--r--node_modules/os-locale/readme.md53
4 files changed, 0 insertions, 220 deletions
diff --git a/node_modules/os-locale/index.js b/node_modules/os-locale/index.js
deleted file mode 100644
index 1ada7a494..000000000
--- a/node_modules/os-locale/index.js
+++ /dev/null
@@ -1,101 +0,0 @@
-'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;
-});
diff --git a/node_modules/os-locale/license b/node_modules/os-locale/license
deleted file mode 100644
index 654d0bfe9..000000000
--- a/node_modules/os-locale/license
+++ /dev/null
@@ -1,21 +0,0 @@
-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.
diff --git a/node_modules/os-locale/package.json b/node_modules/os-locale/package.json
deleted file mode 100644
index 84c095333..000000000
--- a/node_modules/os-locale/package.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "name": "os-locale",
- "version": "2.1.0",
- "description": "Get the system locale",
- "license": "MIT",
- "repository": "sindresorhus/os-locale",
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
- },
- "engines": {
- "node": ">=4"
- },
- "scripts": {
- "test": "xo && ava"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "locale",
- "lang",
- "language",
- "system",
- "os",
- "string",
- "str",
- "user",
- "country",
- "id",
- "identifier",
- "region"
- ],
- "dependencies": {
- "execa": "^0.7.0",
- "lcid": "^1.0.0",
- "mem": "^1.1.0"
- },
- "devDependencies": {
- "ava": "*",
- "import-fresh": "^2.0.0",
- "xo": "*"
- }
-}
diff --git a/node_modules/os-locale/readme.md b/node_modules/os-locale/readme.md
deleted file mode 100644
index 7c80d3358..000000000
--- a/node_modules/os-locale/readme.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# os-locale [![Build Status](https://travis-ci.org/sindresorhus/os-locale.svg?branch=master)](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)