MCPcopy Create free account
hub / github.com/adobe/react-spectrum / updateLocale

Function updateLocale

packages/dev/s2-docs/src/VisualExampleClient.tsx:1286–1301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284
1285 let extension = control.options ?? 'calendar';
1286 let updateLocale = locale => {
1287 let calendar, numberingSystem;
1288 if (extension === 'calendar') {
1289 calendar = (preferences.find(p => p.value === locale)?.ordering || 'gregory').split(' ')[0];
1290 } else if (extension === 'numberingSystem') {
1291 numberingSystem = new Intl.NumberFormat(locale).resolvedOptions().numberingSystem;
1292 if (numberingSystem === 'arabext') {
1293 numberingSystem = 'arab';
1294 }
1295 }
1296 let newLocale = new Intl.Locale(locale, {
1297 calendar,
1298 numberingSystem
1299 });
1300 onChange(newLocale.toString());
1301 };
1302
1303 let updateCalendar = calendar => {
1304 let newLocale = new Intl.Locale(value, {

Callers

nothing calls this directly

Calls 3

onChangeFunction · 0.70
toStringMethod · 0.65
resolvedOptionsMethod · 0.45

Tested by

no test coverage detected