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

Looks like internationalization is not working properly #212

Open
McPringle opened this issue Sep 17, 2024 · 2 comments
Open

Looks like internationalization is not working properly #212

McPringle opened this issue Sep 17, 2024 · 2 comments
Labels
bug Something isn't working hackergarten Possible issues for Hackergarten events hacktoberfest Possible issues for the Hacktoberfest help wanted Extra attention is needed
Milestone

Comments

@McPringle
Copy link
Owner

When using a browser set to english locale, Apus still shows the german translation instead of the english one.

@McPringle McPringle added the bug Something isn't working label Sep 17, 2024
@McPringle McPringle added this to the v4 milestone Sep 17, 2024
@McPringle McPringle self-assigned this Sep 17, 2024
@McPringle
Copy link
Owner Author

Result of analysis: The default translation file translations.properties is being ignored. If the browser locale has no corresponding translation file, the alphabetically first file will be chosen instead of the default file.

@McPringle McPringle modified the milestones: v4, v5 Oct 20, 2024
@McPringle McPringle added hackergarten Possible issues for Hackergarten events hacktoberfest Possible issues for the Hacktoberfest labels Oct 20, 2024
@McPringle McPringle removed their assignment Nov 12, 2024
@McPringle McPringle added the help wanted Extra attention is needed label Nov 12, 2024
@McPringle
Copy link
Owner Author

McPringle commented Nov 16, 2024

From the Vaadin documentation:

The initial locale is determined by matching the locales provided by the I18NProvider against the Accept-Language header in the initial response from the client.

If an exact match (i.e., language and country) is found, it’ll be used. Otherwise, it tries to match only on language. If neither is found, the locale is set to the first 'supported' locale from I18NProvider.getProvidedLocales(). If that’s empty, Locale.getDefault() is used.

Either the docs are wrong or there is an error I can't find. Apus uses no own 'I18NProvider', so the 'DefaultI18NProvider' provided by Vaadin v24.3+ is used (Apus is based on Vaadin v24.5.4). English is the default, so the english translations are in the fallback file 'translations.properties'. The browser is set to english. The 'Accept-Language' request header is set to english (proven by server-side logging). I would now expect to see the english translations of the UI.

But Apus (Vaadin) is still delivering the german translations. Maybe because the host is set to Swiss German and Vaadin ignore the browser setting. Because even when I add an Africaans ('translations_af.properties') or Danish ('translations_da.properties') translation for testing, which are alphabetically before the German, Vaadin still delivers the German translations.

My result: Either the documentation of Vaadin is wrong or the 'DefaultI18NProvider' has a bug. Okay, there might be a problem with Apus - but I don't think so because I only have to provide the translation file and nothing else...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hackergarten Possible issues for Hackergarten events hacktoberfest Possible issues for the Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant