Expose i18n globals in SignalContext across all windows
This commit is contained in:
parent
55394e17c0
commit
4455328312
13 changed files with 38 additions and 27 deletions
|
@ -7,7 +7,7 @@ import { assertDev } from './assert';
|
|||
function getOptionsWithPreferences(
|
||||
options: Intl.DateTimeFormatOptions
|
||||
): Intl.DateTimeFormatOptions {
|
||||
const hourCyclePreference = window.getHourCyclePreference();
|
||||
const hourCyclePreference = window.SignalContext.getHourCyclePreference();
|
||||
if (options.hour12 != null) {
|
||||
return options;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ const formatterCache = new Map<string, Intl.DateTimeFormat>();
|
|||
export function getDateTimeFormatter(
|
||||
options: Intl.DateTimeFormatOptions
|
||||
): Intl.DateTimeFormat {
|
||||
const locales = window.getPreferredSystemLocales();
|
||||
const locales = window.SignalContext.getPreferredSystemLocales();
|
||||
const optionsWithPreferences = getOptionsWithPreferences(options);
|
||||
const cacheKey = getCacheKey(locales, optionsWithPreferences);
|
||||
const cachedFormatter = formatterCache.get(cacheKey);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue