question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$local returns the wrong local.

See original GitHub issue

From 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kaisermanncommented, Nov 30, 2020

because you know that there will never be any message from the fr-FR, locale so it will always fallback.

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. 🤔

0reactions
kaisermanncommented, Dec 1, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found