Add a menu to override the detected language

This commit is contained in:
Samuel Elliott 2023-01-29 12:50:46 +00:00
parent b91b98060d
commit ecb7c578c9
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6

View File

@ -14,6 +14,7 @@ import { createWindow } from './windows.js';
import { WindowType } from '../common/types.js';
import CoralApi from '../../api/coral.js';
import { CachedWebServicesList } from '../../common/users.js';
import { languages } from '../i18n/index.js';
const debug = createDebug('app:main:menu');
@ -120,6 +121,14 @@ export default class MenuApp {
menu.append(new MenuItem({type: 'separator'}));
menu.append(new MenuItem({label: t('show_main_window')!, click: () => this.app.showMainWindow()}));
menu.append(new MenuItem({label: t('preferences')!, click: () => this.app.showPreferencesWindow()}));
if (dev) menu.append(new MenuItem({label: 'Language', submenu: Menu.buildFromTemplate([
...this.app.i18n.options.supportedLngs || ['cimode'],
].map(l => new MenuItem({
label: languages[l as keyof typeof languages]?.name ?? l,
type: 'checkbox',
checked: (this.app.i18n.resolvedLanguage ?? this.app.i18n.language).toLowerCase() === l.toLowerCase(),
click: () => this.app.i18n.changeLanguage(l),
})))}));
if (dev) menu.append(new MenuItem({label: 'Dump notifications state', click: () => {
debug('Accounts', this.app.monitors.notifications.accounts);
debug('Friends', this.app.monitors.notifications.onlinefriends);