7 Replies Latest reply on Dec 6, 2006 5:52 PM by Jarkko Lietolahti

    Problems with i18n in Chinese

    Seto Kaiba Expert

      I used the method written in the reference with properties.
      I saved the properties in UTF8 encoding. Yet I can't display it correctly.
      The words inputed in the html or from the database all display correctly.
      Can someone help me?

        • 1. Re: Problems with i18n in Chinese
          Gavin King Master

          Show your XHTML or JSP.

          • 2. Re: Problems with i18n in Chinese
            Seto Kaiba Expert

             

            <?xml version="1.0" encoding="utf-8"?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a="https://ajax4jsf.dev.java.net/ajax">
             <f:view>
             <head>
             <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
             <title>#{messages['SiteTitle']}</title>
             <!-- ????? -->
             <link rel="stylesheet" href="css/global.css" type="text/css" media="all" />
             </head>
             <body>
             <div align="center">
             <div id="header">
             </div>
             <div id="search">
             <h:form>
             <div id="search_left">
             <h:selectOneMenu value="#{localeSelector.language}">
             <f:selectItems value="#{localeSelector.supportedLocales}"/>
             </h:selectOneMenu>
             <h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>
             </div>
             <div id="search_right">
             <div id="search_string">
             ???
             <h:inputText value="#{articleSearch.searchString}" style="width: 140px; height: 20px"/>
             </div>
             &#160;
             <h:selectOneMenu id="search_field" value="#{articleSearch.field}">
             <f:selectItem itemLabel="-???-" itemValue="title" />
             <f:selectItem itemLabel="tag" itemValue="tag" />
             <f:selectItem itemLabel="??" itemValue="title" />
             <f:selectItem itemLabel="???" itemValue="short_title" />
             <f:selectItem itemLabel="???" itemValue="long_title" />
             <f:selectItem itemLabel="??" itemValue="author" />
             <f:selectItem itemLabel="??" itemValue="intro" />
             <f:selectItem itemLabel="??" itemValue="content" />
             </h:selectOneMenu>
             &#160;
             <a:commandButton value="??"
             action="#{articleSearch.doSearchWithRedirect}" styleClass="button"/>
             </div>
             </h:form>
             </div>
             <div id="main">
             <ui:insert name="content" />
             </div>
             <div id="footer">
             ???? | ???? | ???? | ???? | ????? | ???? | ???? | ???? | ???? | ????
             </div>
             <div id="copyright">
             ???? ???? ???? KaibaSeto@gmail.com
             <br />
             ????IE6?????????
             </div>
             </div>
             </body>
             </f:view>
            </html>
            


            SiteTitle = ??mm
            ChangeLanguage = ????
            


            The problem is the Chinese display incorrectly.

            • 3. Re: Problems with i18n in Chinese
              Seto Kaiba Expert

              <?xml version="1.0" encoding="utf-8"?>
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:a="https://ajax4jsf.dev.java.net/ajax">
              <f:view>

              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              #{messages['SiteTitle']}
              <!-- ????? -->







              <h:form>

              <h:selectOneMenu value="#{localeSelector.language}">
              <f:selectItems value="#{localeSelector.supportedLocales}"/>
              </h:selectOneMenu>
              <h:commandButton action="#{localeSelector.select}" value="#{messages['ChangeLanguage']}"/>



              ???
              <h:inputText value="#{articleSearch.searchString}" style="width: 140px; height: 20px"/>

              &#160;
              <h:selectOneMenu id="search_field" value="#{articleSearch.field}">
              <f:selectItem itemLabel="-???-" itemValue="title" />
              <f:selectItem itemLabel="tag" itemValue="tag" />
              <f:selectItem itemLabel="??" itemValue="title" />
              <f:selectItem itemLabel="???" itemValue="short_title" />
              <f:selectItem itemLabel="???" itemValue="long_title" />
              <f:selectItem itemLabel="??" itemValue="author" />
              <f:selectItem itemLabel="??" itemValue="intro" />
              <f:selectItem itemLabel="??" itemValue="content" />
              </h:selectOneMenu>
              &#160;
              <a:commandButton value="??"
              action="#{articleSearch.doSearchWithRedirect}" styleClass="button"/>

              </h:form>


              <ui:insert name="content" />


              ???? | ???? | ???? | ???? | ????? | ???? | ???? | ???? | ???? | ????


              ???? ???? ???? KaibaSeto@gmail.com

              ????IE6?????????



              </f:view>


              SiteTitle = ??mm
              ChangeLanguage = ????

              • 4. Re: Problems with i18n in Chinese
                Seto Kaiba Expert

                I have found the problem that I must type as \uXXXX in the properties. If I look up all the charaters must cost me a lot of time. Any better sollutions?

                • 5. Re: Problems with i18n in Chinese
                  Seto Kaiba Expert

                  I want to just type it as usual. I think that it should be the problem of encoding. But methods I tried , none works.

                  • 6. Re: Problems with i18n in Chinese
                    Daniel Young Novice

                    Hi Seto,

                    We've also found on our project that we need to use the \uXXXX format in our properties files. If you find a solution, or if anybody has one, please post back!

                    thanks,
                    Daniel.

                    • 7. Re: Problems with i18n in Chinese
                      Jarkko Lietolahti Novice

                      Use editor which supports automatic encoding. Like http://www.resourcebundleeditor.com/ for Eclipse, and i'll bet others exists for different IDEs.