lib
lib copied to clipboard
[i18n]: Non-standard locale provided:
Been trying to figure this one out, can't seem to find where it's coming from?
Non-standard locale provided: 'static'. Check your 'translations' and 'loaders' in i18n config...
There is other unmentioned possibility that your locale static value comes from locale.set(…) (and not from your config). This warning should be definitely updated..
anyway you could use log.level = 'debug' config which should give you more detailed information so maybe then you could see where the wrong locale input comes from..
Hmm, think it's referring to my static folder for whatever reason 🤔
That’s weird, there has to be something wrong in your config (I didn’t notice similar behavior in any of examples and also tests work well).. could you provide some repro?.)
Hmm weird, haven't really changed anything 🤔
https://github.com/Swepool/nbx-site
debug doesn't really give me anything, but everything seems work.
Ok, I’ll run it during today, but on a first look I would say there is some bad img src (or other static asset) with route-like url so it’s probably accepted here and/or here
i just tried and i'm not getting the warning - was it some specific page/app state?
Make sure you changed the log level or remove it. It's whenever I'm switching page 🤔
Ok, that's weird, but it seems that .woff files go through the load function in SvelteKit so it is recognized as a url to parse the locale from... Just tried to insert this supercool log console.log(`lang constant in the __layout 'load' function has '${lang}' value – parsed from '${pathname}' pathname.`); after const lang = ... and getting:
lang constant in the __layout 'load' function has 'static' value – parsed from '/static/fonts/basis-grotesque-bold-pro.woff' pathname.
[i18n]: Non-standard locale provided: 'static'. Check your 'translations' and 'loaders' in i18n config...
lang constant in the __layout 'load' function has 'static' value – parsed from '/static/fonts/basis-grotesque-off-white-pro.woff' pathname.
[i18n]: Non-standard locale provided: 'static'. Check your 'translations' and 'loaders' in i18n config...
lang constant in the __layout 'load' function has 'en' value – parsed from '/en/about' pathname.
// ^^^ This one is correct => no additional warnings
lang constant in the __layout 'load' function has 'static' value – parsed from '/static/fonts/basis-grotesque-regular-pro.woff' pathname.
[i18n]: Non-standard locale provided: 'static'. Check your 'translations' and 'loaders' in i18n config...
Not 100% sure yet, but It seems like a SvelteKit's bug to me...
Interesting 🤔 hmmm... that's strange..
It also prompts this message when adding a “service-worker” file in the project.
[i18n]: Non-standard locale provided: 'service-worker.js'. Check your 'translations' and 'loaders' in i18n config...
Not tested yet, but I guess it’s probably the same issue with SvelteKit..
Hello all, I believe the error is due to you NOT using a standard language code. An example of this would be using "jp" for Japan. The correct country abreviation is "ja". For a full list see here: language_codes. Possibly you have "static" as a language Code????
export const defaultLocale = 'fr';
export const { t, locale, locales, loading, loadTranslations, translations } = new i18n(config);
loading.subscribe(async ($loading) => {
if ($loading) {
await loading.toPromise();
}
});
I'm using 'en' and 'fr', which it seems to be ok.
I got this warning for using 'nn' which is in the list.
I had this problem, in my case the non standard locale message was 'images'. It was caused by a url to a file ('/images/arrow.svg') that didn't exist anymore. The url was in a scss file that i loaded globaly
Correct me if i'm wrong, but i think that current version of SvelteKit no longer loads static assets through the load function, so i'm closing this issue for now..