@yiiamee/multilinguist 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,9 +23,11 @@ export default function useLocalization(supportedLanguages, defaultLocale) {
|
|
|
23
23
|
};
|
|
24
24
|
const setLocale = async (newLocale) => {
|
|
25
25
|
if (!loadedLanguages.value[newLocale] && supportedLanguages.includes(newLocale)) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const response = await fetch(`/locales/${newLocale}.json`);
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
throw new Error(`Locale ${newLocale} not found`);
|
|
29
|
+
}
|
|
30
|
+
const loadedLocale = await response.json();
|
|
29
31
|
loadedLanguages.value[newLocale] = loadedLocale;
|
|
30
32
|
}
|
|
31
33
|
userSelectedLocale.value = newLocale;
|