Skip to content

Commit

Permalink
chore: minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Sep 3, 2023
1 parent ebeec58 commit 389e115
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"node": ">= 16"
},
"volta": {
"node": "16.0.0"
"node": "16.14.0"
},
"scripts": {
"clean": "rm -rf dist/",
Expand Down
11 changes: 7 additions & 4 deletions src/runtime/configs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCanonicalLocales } from '@formatjs/intl-getcanonicallocales'
import { getCanonicalLocales } from '@formatjs/intl-getcanonicallocales';

import { $locale, getCurrentLocale, getPossibleLocales } from './stores/locale';
import { hasLocaleQueue } from './modules/loaderQueue';
Expand Down Expand Up @@ -81,13 +81,16 @@ export function init(opts: ConfigureOptionsInit) {
const { formats, ...rest } = opts;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
let initialLocale = opts.fallbackLocale;
if ( opts.initialLocale ) {

if (opts.initialLocale) {
try {
const canonicalizedLocale = getCanonicalLocales(opts.initialLocale);
if ( canonicalizedLocale.length >= 1 ) {

if (canonicalizedLocale.length >= 1) {
initialLocale = canonicalizedLocale[0];
}
} catch {}
// eslint-disable-next-line no-empty
} catch (e) {}
}

if (rest.warnOnMissingMessages) {
Expand Down

0 comments on commit 389e115

Please sign in to comment.