Try to use system language as the default spellcheck language

This commit is contained in:
Mr. Stallion 2021-09-11 16:21:53 -05:00
parent abbcc6fcbf
commit f62aef49b3
1 changed files with 10 additions and 1 deletions

View File

@ -5,13 +5,22 @@ import log from 'electron-log'; //tslint:disable-line:match-default-export-name
export const defaultHost = 'wss://chat.f-list.net/chat2'; export const defaultHost = 'wss://chat.f-list.net/chat2';
function getDefaultLanguage(): string {
try {
return (electron.app.getLocale() || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en-GB')
.replace(/[.:].*/, '');
} catch (err) {
return 'en-GB';
}
}
export class GeneralSettings { export class GeneralSettings {
account = ''; account = '';
closeToTray = true; closeToTray = true;
profileViewer = true; profileViewer = true;
host = defaultHost; host = defaultHost;
logDirectory = path.join(electron.app.getPath('userData'), 'data'); logDirectory = path.join(electron.app.getPath('userData'), 'data');
spellcheckLang: string[] | string | undefined = 'en_GB'; spellcheckLang: string[] | string | undefined = [getDefaultLanguage()];
theme = 'default'; theme = 'default';
version = electron.app.getVersion(); version = electron.app.getVersion();
beta = false; beta = false;