Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing console warnings #68

Open
Martok88 opened this issue Jul 4, 2024 · 0 comments
Open

Confusing console warnings #68

Martok88 opened this issue Jul 4, 2024 · 0 comments

Comments

@Martok88
Copy link

Martok88 commented Jul 4, 2024

I'm using this package with SvelteKit, and it works well, but I'm getting a lot of warnings in the browser console like this:

[svelte-intl-precompile] The message "chat_history_1" was not found in "", "en".

Note: there are at least one loader still registered to this locale that wasn't executed.

This is the locale init code in my +layout.svelte:

registerAll();
let lang = "en";
if (browser && navigator.languages && !$settings.language) {
	for (const navLang of navigator.languages) {
		if (Object.keys(localesMap).includes(navLang.slice(0, 2))) {
			lang = navLang.slice(0, 2);
			break;
		}
	}
	$settings.language = lang;
} else if ($settings.language) {
	lang = $settings.language;
}
init({ fallbackLocale: "en", initialLocale: lang });

Object.keys(localesMap) evaluates to an array of 2-letter language codes supported by the app, and $settings.language is the user's language preference, if logged in. I'm seeing the warnings whether logged in or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant