-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactor i18n setup to use async function for locale registration
- Loading branch information
1 parent
52ac2d6
commit 1327317
Showing
1 changed file
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
import { init, register, getLocaleFromNavigator } from 'svelte-i18n'; | ||
|
||
register('en', () => import('./../locales/en.json')); // English | ||
register('es', () => import('./../locales/es.json')); // Spanish | ||
register('pl', () => import('./../locales/pl.json')); // Polish | ||
register('vi', () => import('./../locales/vi.json')); // Vietnamese | ||
register('tl', () => import('./../locales/tl.json')); // Tagalog | ||
register('so', () => import('./../locales/so.json')); // Somali | ||
register('am', () => import('./../locales/am.json')); // Amharic | ||
register('ar', () => import('./../locales/ar.json')); // Arabic | ||
async function setup() { | ||
register('en', () => import('./../locales/en.json')); // English | ||
register('es', () => import('./../locales/es.json')); // Spanish | ||
register('pl', () => import('./../locales/pl.json')); // Polish | ||
register('vi', () => import('./../locales/vi.json')); // Vietnamese | ||
register('tl', () => import('./../locales/tl.json')); // Tagalog | ||
register('so', () => import('./../locales/so.json')); // Somali | ||
register('am', () => import('./../locales/am.json')); // Amharic | ||
register('ar', () => import('./../locales/ar.json')); // Arabic | ||
|
||
init({ | ||
fallbackLocale: 'en', | ||
initialLocale: getLocaleFromNavigator() | ||
}); | ||
return await Promise.allSettled([ | ||
init({ | ||
fallbackLocale: 'en', | ||
initialLocale: getLocaleFromNavigator() | ||
}) | ||
]); | ||
} | ||
|
||
await setup(); |