1 Reply Latest reply on Jan 23, 2013 7:05 PM by Caleb W

    Custom language code

    CQ5User Level 1


      I want to use different version of Chinese - traditional and simplified.

      We have used zh-Hant and zh-Hans for those on non CQ prjects that has dependency on CQ.

      Can i customize these languages in CQ so that it could be same across different project.

      Currently it is supported as zh_tw, zh_cn (/libs/wcm/core/resources/languages) . My concern is whether i can use zh-Hant and zh-Hans for languages.

      If i use different lang code , the language list is not populated in Translation section in sidekick.




        • 1. Re: Custom language code
          Caleb W Level 1



          I was attempting to do something similar recently - in my case we were trying to use jp instead of ja for a Japanese site. There is a way to make this work, but there is one potential issue to be aware of. You can create a content tree using any arbitrary path then explicitly set the language for that tree. In your case you would do the following:

          1. Create a page at /content/<app>/zh-Hans
          2. Open the Page Properties for this pages (either by navigating to it and opening Page Properties in the Sidekick or by right clicking the page in the Websites view and selecting Properties)
          3. Select the 'Advanced' tab.
          4. In the language field select Chinese (Simplified) (China). This will set the jcr:language property to 'zh_cn' on the node /content/<app>/zh-Hans/jcr:content. All child pages will inherit this property


          There is a potential issue with this approach however. If you need to retrieve the language of the page in your JSP code you'll need use the following syntax:



          Passing false to the getLanguage method forces CQ to look for the jcr:language property, which in this case will return a Locale object matching 'zh_cn'. If instead you pass true to getLanguage CQ will only search in the path for an ISO language code. Since zh-Hans is not a valid ISO code none will be found and the default Locale will be returned , which is most likely not what you want.