-
1. Re: TabPanel internationalization.
ilya_shaikovsky Nov 17, 2010 6:35 AM (in response to mpula)you loading some properties with loadBundle? then use a4j: one instead of f: one tag.
if not the case - show the code.
-
2. Re: TabPanel internationalization.
mpula Nov 29, 2010 7:30 AM (in response to ilya_shaikovsky)I have already done workaround for this problem. But I am curious why previous version did not work.
Description of the problem.
Some page (jsf + faceletes):
<a4j:form style="clear:both"> <rich:tabPanel headerAlignment="right" switchType="ajax"> <rich:tab label="#{msgs.label1}" action="#{someBean.someAction}"> <ui:include src="./somePage.xhtml"> </ui:include> </rich:tab> <rich:tab label="#{msgs.label2}" action="#{someBean2.someAction2}"> <ui:include src="./somePage2.xhtml"> </ui:include> </rich:tab> </rich:tabPanel> </a4j:form>
On somePage.xhtml and somePage2.xhtml I have a few rich:comboBox components. For this combobox I have converter:
public class PrepaidTypeConverter implements Converter { private static final MessagesBundleManager msgs = MessagesBundleManager.getInstance(); //loads messages from bundle private String ALL_ITEMS_LABEL = msgs.getMessage("combo_box_all"); @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { //some code } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if ((value != null) && (value instanceof SomeType)) { SomeType object = (SomeType) value; String key = object.getName(); return msgs.getMessage(key); } return ALL_ITEMS_LABEL; } }
Now the problem is only when comboBox has not have a selected value. Private field ALL_ITEMS_LABEL have correct value only for first tab in tabPanel. When I change tab to other panel ALL_ITEMS_LABEL have value read from default bundle.
When I change tabPanel switchType to client then is OK. But to have still ajax switchType I remember locale in some session bean wher user logs on. And modify converter:
private SessionBean sessionBean = (SessionBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("sessionBean"); private String ALL_ITEMS_LABEL = msgs.getMessage("combo_box_all", sessionBean.getLocale());
Could someone tell me why ALL_ITEMS_LABEL on other tabPanel than first is always in default language (in my first solution)?