[jboss-user] [JBoss Seam] - Re: language resource bundle example
grdzeli_kaci
do-not-reply at jboss.com
Wed Mar 21 02:01:14 EDT 2007
"waynebagguley" wrote : The locale "ka(Georgian)" is not supported by Java.
i think java supports ka(Georgian). I build example without seam, sample jsf project (or JSP project) and everithing works fine. here is my jsf example:
1. faces-config.xml
| <application>
| <locale-config>
| <default-locale>en</default-locale>
| <supported-locale>en</supported-locale>
| <supported-locale>ka</supported-locale>
| </locale-config>
| </application>
|
2. I created two Language property files:
LocalizationResources_en.properties
hello=HELLO WORLD EN!
LocalizationResources_ka.properties
hello=HELLO WORLD KA!
3. Login page:
| <h:form id="loginForm">
| <h:panelGrid columns="2">
| <h:outputText value="Language: " />
| <h:selectOneMenu value="#{loginBean.language}">
| <f:selectItem itemValue="ka" itemLabel="Georgian"/>
| <f:selectItem itemValue="en" itemLabel="English"/>
| </h:selectOneMenu>
| </h:panelGrid>
| <h:commandButton action="#{loginBean.doLogin}" value="Log In" id="gbutton" />
| </h:form>
|
4. LoginBean.java
|
| private String language;
|
| ................................
|
| public String doLogin() {
|
| FacesContext facesContext = FacesContext.getCurrentInstance();
| Locale locale = new Locale(language);
| facesContext.getViewRoot().setLocale(locale);
|
| return "navigation";
|
| }
|
5. and at last result page after language choose:
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
| <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
| <f:loadBundle basename="LocalizationResources" var="bundle"/>
|
| <html>
| <head>
| <title></title>
| </head>
| <body>
| <f:view locale="">
| <h:outputText value="#{bundle.hello}" />
| </f:view>
| </body>
| </html>
|
all works fine, if i choose Georgian from select item componet on result page i saw georgian caption otherwise i saw english captions
i think that problem is in seam not java or jsf.
ooo yes avbentem, i forget i have this documentation and i did all what there is, all works fine, only georegian has problem.
my select item component looks like :
| <h:selectOneMenu
| value="#{localeSelector.localeString}"
| onchange="submit();"
| valueChangeListener="#{localeSelector.select}">
| <f:selectItems value="#{localeSelector.supportedLocales}" />
| </h:selectOneMenu>
|
and faces-config.xml i wrote above.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030105#4030105
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030105
More information about the jboss-user
mailing list