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

Function updateLocale

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

Source from the content-addressed store, hash-verified

1267
1268 let extension = control.options ?? 'calendar';
1269 let updateLocale = locale => {
1270 let calendar, numberingSystem;
1271 if (extension === 'calendar') {
1272 calendar = (preferences.find(p => p.value === locale)?.ordering || 'gregory').split(' ')[0];
1273 } else if (extension === 'numberingSystem') {
1274 numberingSystem = new Intl.NumberFormat(locale).resolvedOptions().numberingSystem;
1275 if (numberingSystem === 'arabext') {
1276 numberingSystem = 'arab';
1277 }
1278 }
1279 let newLocale = new Intl.Locale(locale, {
1280 calendar,
1281 numberingSystem
1282 });
1283 onChange(newLocale.toString());
1284 };
1285
1286 let updateCalendar = calendar => {
1287 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