You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Jeanne Waldman <je...@oracle.com> on 2007/12/20 20:47:07 UTC

[Trinidad] NLS bug re: formatting locale

Hi there,
Our local NLS expert brought this bug to my attention. I created a JIRA 
issue https://issues.apache.org/jira/browse/TRINIDAD-879

Here is what I have there. Let me know if you think that this is not a 
bug. I plan to fix it.
Thanks!
Jeanne
----
Trinidad embedded translations should always honor "view locale".

Problem:
1. Usually Trinidad embedded translations are honoring "view
locale"
2. However, when "formatting locale" is specified, translations will be
following formatting locale instead.

In theory, only localization definitions (such as date format
pattern) should follow formatting locale.

Here's a testcase. The idea is:
- we would like to have formatting support according to locale "Traditional
Chinese-Hong Kong" (zh-HK).
- However, language translations in Traditional Chinese (zh-TW) due
to that fact that we do not provide zh-HK translations.

facestring.jspx
===============
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:tr="http://myfaces.apache.org/trinidad" >
   <jsp:directive.page contentType="text/html;charset=utf-8"/>
   <f:view locale="zh-TW">
  <tr:document title="InputText Demo">
         <tr:form>
           <p>
             <tr:outputText value="view locale #{view.locale}"/>
           </p>
           <tr:inputText label="test" value="23245">
             <tr:convertDateTime dateStyle="short"/>
           </tr:inputText>
           <tr:commandButton text="Submit"/>
         </tr:form>
  </tr:document>
   </f:view>
</jsp:root>

faces-config.xml
================
...
   <supported-locale>zh-TW</supported-locale>
   <supported-locale>zh-HK</supported-locale>

trinidad-config.xml
===================
<?xml version="1.0" encoding="UTF-8"?>
<trinidad-config xmlns="http:?/?/myfaces.apache.org?/trinidad?/config">

   <formatting-locale>zh-HK</formatting-locale>
</trinidad-config>

Problem:
While formatting is presented in zh-HK, language translations are not shown
in Traditional Chinese.
Valid example: 98ChineseChar11ChineseChar29ChineseChar
As a Reference Testcase:

Remove formatting-locale in trinidad-config.xml (i.e. only view locale =
zh-tw below)
Traditional Chinese translations present and shown correctly.
ChineseChars "23245" ChineseChars. ChineseChars: "1998/11/29".

While Trinidad supports more than 130 locales in terms of
localization formatting (there are 132 files of
META-INF/adf/jsLibs/resources/LocaleElements_*.js),
- there are only 32 languages provided for translations (there are 33 files
of oracle/adfinternal/view/faces/renderkit/rich/resource/RichBundle_*.class)

A fallback approach will be often required for appropriate i18n support. For
example:

   locale formatting language translations
   ================= =====================
   zh-HK zh-TW
   zh-SG zh-CN
   zh-MO zh-TW
   etc.


Re: [Trinidad] NLS bug re: formatting locale

Posted by Jeanne Waldman <je...@oracle.com>.
I'm going to check my fix in today. I can back it out if anyone has any 
objections, which I don't foresee.
thanks!
Jeanne

Jeanne Waldman wrote:
> Hi there,
> Our local NLS expert brought this bug to my attention. I created a JIRA 
> issue https://issues.apache.org/jira/browse/TRINIDAD-879
> 
> Here is what I have there. Let me know if you think that this is not a 
> bug. I plan to fix it.
> Thanks!
> Jeanne
> ----
> Trinidad embedded translations should always honor "view locale".
> 
> Problem:
> 1. Usually Trinidad embedded translations are honoring "view
> locale"
> 2. However, when "formatting locale" is specified, translations will be
> following formatting locale instead.
> 
> In theory, only localization definitions (such as date format
> pattern) should follow formatting locale.
> 
> Here's a testcase. The idea is:
> - we would like to have formatting support according to locale "Traditional
> Chinese-Hong Kong" (zh-HK).
> - However, language translations in Traditional Chinese (zh-TW) due
> to that fact that we do not provide zh-HK translations.
> 
> facestring.jspx
> ===============
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
>           xmlns:f="http://java.sun.com/jsf/core"
>           xmlns:tr="http://myfaces.apache.org/trinidad" >
>   <jsp:directive.page contentType="text/html;charset=utf-8"/>
>   <f:view locale="zh-TW">
>  <tr:document title="InputText Demo">
>         <tr:form>
>           <p>
>             <tr:outputText value="view locale #{view.locale}"/>
>           </p>
>           <tr:inputText label="test" value="23245">
>             <tr:convertDateTime dateStyle="short"/>
>           </tr:inputText>
>           <tr:commandButton text="Submit"/>
>         </tr:form>
>  </tr:document>
>   </f:view>
> </jsp:root>
> 
> faces-config.xml
> ================
> ...
>   <supported-locale>zh-TW</supported-locale>
>   <supported-locale>zh-HK</supported-locale>
> 
> trinidad-config.xml
> ===================
> <?xml version="1.0" encoding="UTF-8"?>
> <trinidad-config xmlns="http:?/?/myfaces.apache.org?/trinidad?/config">
> 
>   <formatting-locale>zh-HK</formatting-locale>
> </trinidad-config>
> 
> Problem:
> While formatting is presented in zh-HK, language translations are not shown
> in Traditional Chinese.
> Valid example: 98ChineseChar11ChineseChar29ChineseChar
> As a Reference Testcase:
> 
> Remove formatting-locale in trinidad-config.xml (i.e. only view locale =
> zh-tw below)
> Traditional Chinese translations present and shown correctly.
> ChineseChars "23245" ChineseChars. ChineseChars: "1998/11/29".
> 
> While Trinidad supports more than 130 locales in terms of
> localization formatting (there are 132 files of
> META-INF/adf/jsLibs/resources/LocaleElements_*.js),
> - there are only 32 languages provided for translations (there are 33 files
> of 
> oracle/adfinternal/view/faces/renderkit/rich/resource/RichBundle_*.class)
> 
> A fallback approach will be often required for appropriate i18n support. 
> For
> example:
> 
>   locale formatting language translations
>   ================= =====================
>   zh-HK zh-TW
>   zh-SG zh-CN
>   zh-MO zh-TW
>   etc.
> 
>