dev@woodstock.java.net

Re: Localization on the fly

From: mike.r.phillips <mike.r.phillips_at_comcast.net>
Date: Wed, 3 Dec 2008 11:47:40 -0800 (PST)

We are using woodstock version ...
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
Implementation-Title: Woodstock Components 4.0 Theme: suntheme

The link you gave me gave me an idea. It may be a bad idea but it works.
If I use the following code the page renders with the new locale information
even for the
woodstock components. It is not automatic but at least I can bind it to a
choose locale button, and
work from there.
  public String button3_action()
  {
    FacesContext fc = this.getFacesContext();
    HttpServletRequest req = (HttpServletRequest)
fc.getExternalContext().getRequest();

    JSFThemeContext tc = (JSFThemeContext) JSFThemeContext.getInstance(fc);
    tc.setDefaultLocale(req.getLocale());

    return "DBOrderTest";
  }


mike.r.phillips wrote:
>
> Can woodstock localization be based on the users current browser language
> choice(request.getLocale())?
>
> After creating a sun/webui/jsf/suntheme/messages/messages_de.properties
> I can only get the correct localized strings and buttons used by the
> underlying components to be used if I add
> a JVM option "-Duser.language=de" to the app server, or if I use
> Locale.setDefault(choosenLocale) and then
> re-deploy my app.
>
> if I use <f:view locale="<%= request.getLocale() %>"> the bundles I create
> that are not part of
> underlying components are localized correctly and change for each user
> base on browser preference.
>
> Is there a way to tell components to reload the localized strings without
> bouncing app server?
>

-- 
View this message in context: http://www.nabble.com/Localization-on-the-fly-tp20802795p20820182.html
Sent from the Project Woodstock - Dev mailing list archive at Nabble.com.