[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Language  XML
Forum Index -> Development
Author Message
ddammann

Power User

Joined: 13/09/2010 09:41:07
Messages: 66
Location: München
Offline

Hi,

In browsers you can deside the preferred language for contents.
Our application use the Locale.getDefault(). But Locale.getDefault() will not have a effect on browser language selection. We don't want a extra language seletion in our aplication.

Should I do something else to set the preferred language in our application?

regards
Dörte
ddammann

Power User

Joined: 13/09/2010 09:41:07
Messages: 66
Location: München
Offline

It was my problem.

If I use
FacesContext.getCurrentInstance().getViewRoot().setLocale(Locale.getDefault());
at the top of my program it works.

regards
Dörte
ddammann

Power User

Joined: 13/09/2010 09:41:07
Messages: 66
Location: München
Offline

It's not enough

Locale.getDefault() get always 'en', even if my computer work with 'de' and the preferred language of browser is 'de'.

If I remove the FacesContext code I get a german application.

How can I get the preferred language of browser?

regards
Dörte
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

As I know it's not that easy to get the browsers language settings!
The point is that CC is running as an applet in your browser, this is a sandbox so you have no direct access to the browsers preferences!
Maybe there's a way to inject this info with javascript?

What you get is the language the local JVM is running

regards
Markus
[WWW]
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

I made an example, I will post this to the Snippets Zone
[WWW]
ddammann

Power User

Joined: 13/09/2010 09:41:07
Messages: 66
Location: München
Offline

Thanks
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team