$local returns the wrong local.
See original GitHub issueFrom the following i18n config
import { addMessages, init, getLocaleFromNavigator } from "svelte-i18n";
import enUs from "../locales/enUs.json";
addMessages("en-US", enUs);
init({
fallbackLocale: "en-US",
initialLocale: getLocaleFromNavigator()
});
Doing the following
<script>
import { locale } from "svelte-i18n";
$: console.log($locale)
</script>
returns fr-FR
.
Isn’t $locale
supposed to return the locale currently used by svelte-i18n? As fr-FR
is not in the dictionary shouldn’t it fallback to en-US
?
Information about your project:
-
Tried on chrome and safari
-
MacOS 11
-
v3.3.0
-
Rollup
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
What should I do if local taxes were withheld incorrectly?
You, most likely, will have to file a county return for the wrong county, to get a refund of withholding. And file a...
Read more >Resolving the "function returns address of local variable" error
The return statement should not return a pointer that has the address of a local variable ( sum ) because, as soon as...
Read more >C++" reference to local variable returned " - Stack Overflow
I'm getting an error with this function. Saying " warning: reference to local variable 'final' returned" Any ideas what is wrong with it?...
Read more >Troubleshooting Local - Local WP
Issues with the Local App. Common problems with the Local app include: Error messages within the Local window; Buttons within the Local window...
Read more >How do I figure out where wrong local dns results are coming ...
Something on the local machine is intercepting the request and returning a wrong cached result. I have looked at various caching programs, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not necessarily, but we could check the locale queue to see if there’s any partial dictionary to be loaded. If not and the locale isn’t registered in the dictionary, we could possibly set it to the fallback one. 🤔
Rethinking this 🤔
fr-FR
should be the actual locale if the store was indeed set to it.fr-FR
not being in the dictionary shouldn’t mean that the app should resort completely to the fallback local. It’s just that, for some reason, there weren’t any messages to load.