mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
fix: if locale is not present, set to unspecified
This commit is contained in:
@ -556,11 +556,14 @@ app.on('activate', async () => {
|
||||
});
|
||||
|
||||
const getDefaultLocale = (locale: string) =>
|
||||
Object.keys(languageResources).includes(locale) ? locale : 'en';
|
||||
Object.keys(languageResources).includes(locale) ? locale : null;
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
if (!config.get('options.language')) {
|
||||
config.set('options.language', getDefaultLocale(app.getLocale()));
|
||||
const locale = getDefaultLocale(app.getLocale());
|
||||
if (locale) {
|
||||
config.set('options.language', locale);
|
||||
}
|
||||
}
|
||||
|
||||
await loadI18n().then(async () => {
|
||||
|
||||
@ -379,7 +379,7 @@ export const mainMenuTemplate = async (
|
||||
(lang): Electron.MenuItemConstructorOptions => ({
|
||||
label: `${languageResources[lang].translation.language.name} (${languageResources[lang].translation.language['local-name']})`,
|
||||
type: 'checkbox',
|
||||
checked: config.get('options.language') === lang,
|
||||
checked: (config.get('options.language') ?? 'en') === lang,
|
||||
click() {
|
||||
config.setMenuOption('options.language', lang);
|
||||
refreshMenu(win);
|
||||
|
||||
Reference in New Issue
Block a user