Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'doesn',
'hadn',
'hasn',
'mightn',
'mustn',
'needn',
'oughtn',
'shan',
'shouldn',
'wasn',
'weren',
'wouldn'
]
// Hunspell requires a fully-qualified locale
export const locale = osLocale.sync().replace('-', '_')
export const setup = function () {
// Need to set LANG env variable so node spellcheck can find its default language
if (!process.env.LANG) {
process.env.LANG = locale
}
if (process.platform === 'linux') {
setupLinux(locale)
} else if (process.platform === 'win32' && semver.lt(os.release(), '8.0.0')) {
setupWin7AndEarlier(locale)
} else {
// OSX and Windows 8+ have OS-level spellcheck APIs
console.info('Using OS spell check API')
}
}
function guessLocale () {
if (!detectLocale) return
try {
const osLocale = require('os-locale')
self.locale(osLocale.sync({ spawn: false }))
} catch (err) {
// if we explode looking up locale just noop
// we'll keep using the default language 'en'.
}
}
function guessLocale () {
if (!detectLocale) return
try {
var osLocale = require('os-locale')
self.locale(osLocale.sync({ spawn: false }))
} catch (err) {
// if we explode looking up locale just noop
// we'll keep using the default language 'en'.
}
}
function guessLocale () {
if (!detectLocale) return
try {
const osLocale = require('os-locale')
self.locale(osLocale.sync({ spawn: false }))
} catch (err) {
// if we explode looking up locale just noop
// we'll keep using the default language 'en'.
}
}
function guessLocale () {
if (!detectLocale) return
try {
const osLocale = require('os-locale')
self.locale(osLocale.sync({ spawn: false }))
} catch (err) {
// if we explode looking up locale just noop
// we'll keep using the default language 'en'.
}
}
function guessLocale () {
if (!detectLocale) return
try {
const osLocale = require('os-locale')
self.locale(osLocale.sync({ spawn: false }))
} catch (err) {
// if we explode looking up locale just noop
// we'll keep using the default language 'en'.
}
}
i18n.getLocale = function() {
if (!cache.locale) {
let systemLocale = osLocale.sync();
let availableLocales = i18n.getAvailableLocales();
if (availableLocales.indexOf(systemLocale) !== -1) {
cache.locale = systemLocale;
} else if (availableLocales.indexOf(systemLocale.split("_")[0]) !== -1) {
cache.locale = systemLocale.split("_")[0];
} else {
var looseLocaleMatch;
for (let i = 0, l = availableLocales.length; i < l; i++) {
if (availableLocales[i].split("_")[0] === systemLocale.split("_")[0]) {
looseLocaleMatch = availableLocales[i];
break;
}
}
if (looseLocaleMatch) {
cache.locale = looseLocaleMatch;
} else {
const setSystemLocale = (dispatch, languages, translations) => {
return osLocale().then(locale => {
console.log(`System Locale: ${locale}`);
setActiveLanguageSafely(dispatch, locale, languages, translations);
});
};
export function getLocale() {
return osLocale.sync();
}
function getLocalDoc(schema: JSONSchema): string {
const language = osLocale.sync();
if (schema.document) {
return (language && schema.document[language]) || schema.document['default'];
}
return ''
}