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 "Adam Winer (JIRA)" <ad...@incubator.apache.org> on 2007/01/17 00:50:27 UTC

[jira] Resolved: (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:all-tabpanel ]

Adam Winer resolved ADFFACES-347.
---------------------------------

    Resolution: Fixed
      Assignee: Adam Winer

Fixed.

> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira