Fix timestamps/spellcheck to use locale override

This commit is contained in:
Jamie Kyle 2023-11-06 17:02:13 -08:00 committed by GitHub
parent 59fa75c309
commit fd8691b871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 45 additions and 11 deletions

View file

@ -56,6 +56,7 @@ export function getLanguages(
export const setup = (
browserWindow: BrowserWindow,
preferredSystemLocales: ReadonlyArray<string>,
localeOverride: string | null,
i18n: LocalizerType,
logger: LoggerType
): void => {
@ -74,13 +75,16 @@ export const setup = (
logger.info('spellcheck: dictionary initialized:', lang);
});
// Locale override should be combined with other preferences rather than
// replace them entirely.
const combinedLocales =
localeOverride != null
? [localeOverride, ...preferredSystemLocales]
: preferredSystemLocales;
const availableLocales = session.availableSpellCheckerLanguages;
const languages = getLanguages(
preferredSystemLocales,
availableLocales,
'en'
);
console.log('spellcheck: user locales:', preferredSystemLocales);
const languages = getLanguages(combinedLocales, availableLocales, 'en');
console.log('spellcheck: user locales:', combinedLocales);
console.log(
'spellcheck: available spellchecker languages:',
availableLocales