Skip to content

Commit 40e96a8

Browse files
committed
check if device locale is supported
1 parent 7665cf8 commit 40e96a8

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4747
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4848
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
49-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=274 --cache --cache-location=node_modules/.cache/eslint",
49+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=273 --cache --cache-location=node_modules/.cache/eslint",
5050
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
5151
"lint-watch": "npx eslint-watch --watch --changed",
5252
"shellcheck": "./scripts/shellCheck.sh",

src/components/LocaleContextProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ function LocaleContextProvider({children}: LocaleContextProviderProps) {
9090
if (nvpPreferredLocale && isSupportedLocale(nvpPreferredLocale)) {
9191
return nvpPreferredLocale;
9292
}
93-
return getDevicePreferredLocale();
93+
94+
const deviceLocale = getDevicePreferredLocale();
95+
return isSupportedLocale(deviceLocale) ? deviceLocale : CONST.LOCALES.DEFAULT;
9496
}, [nvpPreferredLocale, nvpPreferredLocaleMetadata]);
9597

9698
useEffect(() => {

0 commit comments

Comments
 (0)