-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Browser Language Preference Needs To Be Honored #15744
Comments
I think this is a specific choice for your app, I'm not sure it would make sense to make it the default behavior. You can still implement it yourself with Spring LocaleResolver |
What I described is the correct multi-language web application behaviour. For example, Gitea, a Github like application, demonstrates the multi-language behaviour. The language setting in the browser will dictate the language display in the application. Try https://try.gitea.io/ |
You have described one way of doing it, there are other ways. Personally, I prefer that each application use its own preferences rather than relying on a global browser setting. But maybe your proposition could be a good default and you could contribute it. |
This issue is stale because it has been open 30 days with no activity. |
Keep it open |
This issue is stale because it has been open 30 days with no activity. |
Currently, I have some free time on hand to look into this issue. I do some coding tracing on the language setting in the front end Vue. Here is what I understand about the language setting:
To solve the issue, a change needed is to set the current language based on the first language in the browser preference priority list which is in the jhipsterConfig.languages. I see a generated Javascript code pormpts.js with some related code: |
I change the following line in the refreshTranslation method of TranslationService.ts file
to
With the change, the browser language setting is considered in the app language selection. |
This issue is stale because it has been open 30 days with no activity. |
I have a fix for this issue in our app. I, however, don't know how to make the change for JHipster generator. |
The easiest way I've found to contribute a fix this this:
Keep in mind that you will need to make these changes for Angular, React, and Vue. |
The related changes are in the jhi-navbar.component.ts..ejs. I made changes based on our application language selections. I am not a Javascript person. So, it will take me longer to have a generic solution. |
@mraible I think it's asking for too much. You can't expect contributors to know well 3 frameworks. |
I can't push my code change due to "remote: Permission to jhipster/generator-jhipster.git denied to ..." |
It's normal, because this is not how it works. You should push to your clone and then create a pull request to main project. |
The change I make for this matter is only on Vue. I have a look at Angular and React, but can't find the related code. As a result, I don't make the same code change for those two sets of front-end code. |
Overview of the issue
When Spanish is on the top of the language setting in my browser, my app still shows the content in the default language, English although Spanish is a language in my app.
Motivation for or Use Case
The browser language setting needs to be honored.
Reproduce the error
Create an app with multiple languages such as English as the default language and Spanish. Set Spanish on the top of your browser language setting. Access the app and it will show in English.
Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
The text was updated successfully, but these errors were encountered: