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

Locale not set correctly on some page loads #250

Open
alkorlos opened this issue Jul 4, 2024 · 2 comments
Open

Locale not set correctly on some page loads #250

alkorlos opened this issue Jul 4, 2024 · 2 comments

Comments

@alkorlos
Copy link

alkorlos commented Jul 4, 2024

Thank you for the great library!

Describe the bug
Find this issue due to the incorrect value of the lang attribute.
svelte-i18n automatically changes the value of the lang attribute on the <html> element. Most of the time, it works correctly. However, on some page loads, the lang attribute gets an incorrect value.

Logs
No errors or warnings.

To Reproduce
svelte-i18n-issue-lang
In reproduce only SvelteKit is initialized, and the svelte-i18n library is added. In this case, the bug appears rarely, but it does appear. Attaching a video 2024-07-04 19-52-07.webm, bug on 8 sec.
When loading the page at the address /de, the lang attribute is must set to de, but once it is set to en.

As mentioned, in the demo above, this bug appears rarely. Encountered it in a project where this error occurs more frequently, can provide a link to the project if needed, it's not commercial code.

When preparing the example, noticed a problem with content localization, not just with the lang attribute. In the project where discovered this issue, only the lang attribute works incorrectly, the content localization is displayed without errors.

Expected behavior
Locale set correctly on all page loads.

Information about your project:

  • Your browser and the version: Chrome 126

  • Your operating system: Windows 10

  • svelte-i18n version 4.0.0

  • Rollup

Additional context
Add any other context about the problem here.

@aiwaki
Copy link

aiwaki commented Jul 19, 2024

Same

@PierrickP
Copy link

More or less the same (some parts of the page are rendered with another lang).

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

3 participants