解决保留用户数据直接安装,首次启动后重载窗体显示英文问题.

This commit is contained in:
chriswang521 2023-08-31 13:42:18 +08:00
parent 08b3ea7ec2
commit 5bfcf91174
1 changed files with 20 additions and 1 deletions

View File

@ -113,10 +113,29 @@
const configFile = path.join(userDataPath, 'languagepacks.json');
try {
if (!fs.existsSync(configFile)) {
console.log('languagepacks.json not exist');
let languagePack = generateLanguagePacks();
return languagePack;
} else {
let config = nodeRequire(configFile);
if (!config) {
return nodeRequire(configFile)
}
locale = resolveLanguagePackLocale(config, locale);
if (!locale) {
return nodeRequire(configFile);
}
const packConfig = config[locale];
if (!packConfig || typeof packConfig.hash !== 'string') {
return nodeRequire(configFile);
}
if (packConfig.hash != 'd40608d6c84271a3245f89217f02df0a' && locale === 'zh-cn') {
let languagePack = generateLanguagePacks();
return languagePack;
}
return nodeRequire(configFile);
}
return nodeRequire(configFile);
// return nodeRequire(configFile);
} catch (err) {
// Do nothing. If we can't read the file we have no
// language pack config.