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

b:dataTable doesn't use browser language #628

Closed
NicolaIsotta opened this issue Jan 27, 2017 · 5 comments
Closed

b:dataTable doesn't use browser language #628

NicolaIsotta opened this issue Jan 27, 2017 · 5 comments
Milestone

Comments

@NicolaIsotta
Copy link
Contributor

NicolaIsotta commented Jan 27, 2017

As the title, I've already prepared a PR which contains two other small fixes.

@stephanrauh
Copy link
Collaborator

@NicolaIsotta I've uploaded a new version of the snapshot to Maven Central, and I've added a demo on the showcase. But I don't know how to test the feature. There used to be a Google Chrome setting allowing me to switch the default language, but it's gone :(. Do you have an idea?

http://www3.bootsfaces.net/Showcase/forms/DataTable.jsf (search for Internationalization)

@NicolaIsotta
Copy link
Contributor Author

NicolaIsotta commented Jan 27, 2017

@stephanrauh
Just put <f:view locale="#{localeBean.locale}"/> somewhere in the xhtml.

Into localeBean, which should be SessionScoped:

private String locale; // getter and setter

@PostConstruct
public void postConstruct() {
    this.locale = FacesContext.getCurrentInstance().getViewRoot().getLocale().getLanguage();
}

Then, in DataTable.xhtml, add a b:selectOneMenu with #{localeBean.locale} as the value and some selectItems with the possible languages.

@stephanrauh
Copy link
Collaborator

Adding the selectItem with itemValue=#{localeBean.locale}' isn't exactly the same as the auto-detection you've implemented :). But you're right, I remember faintly that we used to add a locale setting to the root tag. But if I've got you right, simply omitting the langandlang-url` tags (or setting them to null) should do the trick. Which is what my demo does.

@NicolaIsotta
Copy link
Contributor Author

Yes, if both the values are missing or null the Language is evaluated from the viewroot. Anyway, I think Firefox have the accepted-languages configuration if you need to test.

@stephanrauh
Copy link
Collaborator

Oh. It's an OSX problem. You can set the browser language of Chrome in Windows, but not in OSX. The Mac version always uses the system default language. Now my MacBook speaks Spanish to me, and the datatable does the same, too.

Probably it would have been simpler to install Firefox :).

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

No branches or pull requests

2 participants