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

@ -67,7 +67,11 @@ const formatterCache = new Map<string, Intl.DateTimeFormat>();
export function getDateTimeFormatter(
options: Intl.DateTimeFormatOptions
): Intl.DateTimeFormat {
const locales = window.SignalContext.getPreferredSystemLocales();
const preferredSystemLocales =
window.SignalContext.getPreferredSystemLocales();
const localeOverride = window.SignalContext.getLocaleOverride();
const locales =
localeOverride != null ? [localeOverride] : preferredSystemLocales;
const optionsWithPreferences = getOptionsWithPreferences(options);
const cacheKey = getCacheKey(locales, optionsWithPreferences);
const cachedFormatter = formatterCache.get(cacheKey);