myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luka Surija <luka.sur...@iytim.hr>
Subject [Trinidad] MenuModel locale
Date Sat, 18 Aug 2007 11:07:04 GMT
Can someone explain me why MenuModel isn't working with locale as any 
other JSF component?

code snippet from org.apache.myfaces.trinidadinternal.menu.MenuUtils:
...
static void loadBundle(String resBundle, ThreadLocal<String> key)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> applicationMap =
facesContext.getExternalContext().getApplicationMap();

// Get the request Locale
Locale requestLocale = 
facesContext.getExternalContext().getRequestLocale();

// Make sure it is not null
if (requestLocale == null)
{
requestLocale = facesContext.getViewRoot().getLocale();
if (requestLocale == null)
{
requestLocale = facesContext.getApplication().getDefaultLocale();
}
}

....

I've almost gone crazy because of that until I've checked how 
resourceBundle is managed for MenuModel.

Usually <f:view locale="#{main.locale}" >
should be the first place where to put locale to some page (view), and 
all components inside this view should use locale from resourceBundle 
defined by getViewRoot().getLocale(). So my question is why MenuModel 
uses different approach?




-- 
Luka Ĺ urija
luka.surija@iytim.hr
+385 98 434 061

I.Y. tim d.o.o.
www.iytim.hr
info@iytim.hr



Mime
View raw message