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.

fallback doesn't work

See original GitHub issue
i18n.mjs:1 Uncaught Error: [svelte-i18n] Locale "it-IT" not found.
    at Object.ct.set (i18n.mjs:1)
    at locale.js:17
    at main.js:12

I have english (en) and german (de) defined as my locales, but if I change my language in Chrome to Italian (it-IT). It fails with the above error.

Here is my config:

import { locale, dictionary, getClientLocale } from 'svelte-i18n'
import { de, fr, en } from './i18n'

// Define a locale dictionary
dictionary.set({
  de,
  fr,
  en,
})

// This is a store, so we can subscribe to its changes
locale.subscribe(() => {
  console.log('locale change')
})

// svelte-i18n exports a method to help getting the current client locale
locale.set(
  getClientLocale({
    // the fallback locale, if didn't find any
    fallback: 'en',
    // set to 'true' to check the 'window.navigator.language'
    navigator: true,
    // // set the key name to look for a locale on 'window.location.search'
    // // 'example.com?locale=en-US'
    // search: 'lang'
  }),
)

// Set the current locale to en-US
// locale.set('en')

I just get a blank page (demo: https://puump.com)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ralyodiocommented, Nov 24, 2019

I’m downgrading until you figure out how to fix your bugs.

1reaction
kaisermanncommented, Nov 24, 2019

Fixed on v2.0.1. Please, see https://github.com/kaisermann/svelte-i18n/wiki#setting-the-initial-locale to set the initial and fallback locales in a simpler way 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fallback function does not work solidity
A fallback function is invoked when the contract receives some Ether(or a non existent function is called) but the gas provided is only ......
Read more >
Fallback doesn't work - WordPress.org
Hi Johan,. The fallback image is mostly used in preview.php (on archive pages) and in the recent posts widget. It's not used for...
Read more >
Fallback image when autoplay doesn't work - Stack Overflow
I'm developing my portfolio using React and Gatsby and I am using a video to create an animated shadow. The video is in...
Read more >
Language fallback doesn't work properly · Issue #389 - GitHub
the fallbacks variable is re-evaluate on each failure, because the parameter passed to this.fallbackStrategy.getNextLangs(lang) is the current failed language.
Read more >
Fallback - i18next documentation
If you can not provide the preferred language for a user, you can specify another language as fallback. This is useful to indicate...
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