You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-issues@incubator.apache.org by "Arjuna Wijeyekoon (JIRA)" <ad...@incubator.apache.org> on 2007/02/06 03:19:05 UTC

[jira] Commented: (ADFFACES-347) TranslationsResourceLoader Get Wrong Resourcebundle For Locales Who Have Country Code

    [ https://issues.apache.org/jira/browse/ADFFACES-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470437 ] 

Arjuna Wijeyekoon commented on ADFFACES-347:
--------------------------------------------

Revision: 496905
Author: awiner
Date: 4:48:01 PM, Tuesday, January 16, 2007
Message:
ADFFACES-347: TranslationsResourceLoader Get Wrong Resourcebundle For Locales Who Have Country Code
----
Modified : /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java




> TranslationsResourceLoader Get Wrong Resourcebundle For Locales Who Have Country Code
> -------------------------------------------------------------------------------------
>
>                 Key: ADFFACES-347
>                 URL: https://issues.apache.org/jira/browse/ADFFACES-347
>             Project: MyFaces ADF-Faces
>          Issue Type: Bug
>            Reporter: Adam Winer
>         Assigned To: Adam Winer
>
> From an internal Oracle filer:
> org.apache.myfaces.trinidadinternal.resource.TranslationsResourceLoader.java, 
> the locale is get using the following mechanism:
> .
>  protected String getLocaleString(FacesContext context)
>   {
>     Object localeObj = context.getExternalContext().getRequestParameterMap().
>       get("loc");
>     return (localeObj == null || "".equals(localeObj))
>       ? null : localeObj.toString();
>   }
> which returns a string with language code and country code separated by a 
> underscore, e.g. zh_cn
> .
> then it tries to get a Locale object using the following code:
> .
>  Locale locale = LocaleUtils.getLocaleForIANAString(localeStr);
> .
> while, LocaleUtils.getLocaleForIANAString(String localeStr) can handle only 
> locale strings which use a dash as the separator for language code and 
> country code, since the parameter passed into this method is separated by a 
> underscore, so the parameter is treated as a whole representing language 
> code. then a wrong locale object is returned, i.e. new Locale("zh_CN","") is 
> returned instead of new Locale("zh","CN"). finally, the system cannot find a 
> resource bundle file whose language code is zh_CN, so it return the resource 
> bundle file suffixed by the defult locale of the platform.
> .

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.