forked from openkylin/kylin-code
修复启动错误.
This commit is contained in:
parent
4e6206eee9
commit
0a3b6a331d
|
@ -107,9 +107,10 @@
|
|||
|
||||
/**
|
||||
* @param {string} userDataPath
|
||||
* @param {string} locale
|
||||
* @returns {object}
|
||||
*/
|
||||
function getLanguagePackConfigurations(userDataPath) {
|
||||
function getLanguagePackConfigurations(userDataPath, locale) {
|
||||
const configFile = path.join(userDataPath, 'languagepacks.json');
|
||||
try {
|
||||
if (!fs.existsSync(configFile)) {
|
||||
|
@ -119,7 +120,7 @@
|
|||
} else {
|
||||
let config = nodeRequire(configFile);
|
||||
if (!config) {
|
||||
return nodeRequire(configFile)
|
||||
return nodeRequire(configFile);
|
||||
}
|
||||
locale = resolveLanguagePackLocale(config, locale);
|
||||
if (!locale) {
|
||||
|
@ -129,7 +130,7 @@
|
|||
if (!packConfig || typeof packConfig.hash !== 'string') {
|
||||
return nodeRequire(configFile);
|
||||
}
|
||||
if (packConfig.hash != 'd40608d6c84271a3245f89217f02df0a' && locale === 'zh-cn') {
|
||||
if (packConfig.hash !== 'd40608d6c84271a3245f89217f02df0a' && locale === 'zh-cn') {
|
||||
let languagePack = generateLanguagePacks();
|
||||
return languagePack;
|
||||
}
|
||||
|
@ -139,6 +140,7 @@
|
|||
} catch (err) {
|
||||
// Do nothing. If we can't read the file we have no
|
||||
// language pack config.
|
||||
console.log('getLanguagePackConfigurations error:' + err);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
@ -203,7 +205,7 @@
|
|||
if (!commit) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
const configs = getLanguagePackConfigurations(userDataPath);
|
||||
const configs = getLanguagePackConfigurations(userDataPath, locale);
|
||||
if (!configs) {
|
||||
return defaultResult(initialLocale);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue