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

Function updateLocale

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

Source from the content-addressed store, hash-verified

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