You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "haiwei li (JIRA)" <ji...@apache.org> on 2013/04/22 06:25:15 UTC

[jira] [Updated] (LANG-889) If locale is "pt_pt", it's not a variant

     [ https://issues.apache.org/jira/browse/LANG-889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

haiwei li updated LANG-889:
---------------------------

    Description: 
You hava a spring MVC site, it's support multiple languages.
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
  <property name="paramName" value="locale" />
</bean>
 
You can try url is http://xxx.com/controll/action?locale=pt_pt, it's think so "There is definitely a variant, and it is everything after the country"

form code:
org.springframework.util.StringUtils.parseLocaleString[659]

if (parts.length >= 2) {
			// There is definitely a variant, and it is everything after the country
			// code sans the separator between the country code and the variant.
			int endIndexOfCountryCode = localeString.indexOf(country) + country.length();
			// Strip off any leading '_' and whitespace, what's left is the variant.
			variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
			if (variant.startsWith("_")) {
				variant = trimLeadingCharacter(variant, '_');
			}
		}
		return (language.length() > 0 ? new Locale(language, country, variant) : null);

When locale is "pt_pt", it's result "pt_PT_pt", I think so it's not a variant.


  was:
You hava a spring MVC site, it's support multiple languages. 
You can try url is http://xxx.com/controll/action?locale=pt_pt, it's think so "There is definitely a variant, and it is everything after the country"

form code:
org.springframework.util.StringUtils.parseLocaleString[659]

if (parts.length >= 2) {
			// There is definitely a variant, and it is everything after the country
			// code sans the separator between the country code and the variant.
			int endIndexOfCountryCode = localeString.indexOf(country) + country.length();
			// Strip off any leading '_' and whitespace, what's left is the variant.
			variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
			if (variant.startsWith("_")) {
				variant = trimLeadingCharacter(variant, '_');
			}
		}
		return (language.length() > 0 ? new Locale(language, country, variant) : null);

When locale is "pt_pt", it's result "pt_PT_pt", I think so it's not a variant.


    
> If locale is "pt_pt", it's not a variant
> ----------------------------------------
>
>                 Key: LANG-889
>                 URL: https://issues.apache.org/jira/browse/LANG-889
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: haiwei li
>            Priority: Critical
>
> You hava a spring MVC site, it's support multiple languages.
> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
>   <property name="paramName" value="locale" />
> </bean>
>  
> You can try url is http://xxx.com/controll/action?locale=pt_pt, it's think so "There is definitely a variant, and it is everything after the country"
> form code:
> org.springframework.util.StringUtils.parseLocaleString[659]
> if (parts.length >= 2) {
> 			// There is definitely a variant, and it is everything after the country
> 			// code sans the separator between the country code and the variant.
> 			int endIndexOfCountryCode = localeString.indexOf(country) + country.length();
> 			// Strip off any leading '_' and whitespace, what's left is the variant.
> 			variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
> 			if (variant.startsWith("_")) {
> 				variant = trimLeadingCharacter(variant, '_');
> 			}
> 		}
> 		return (language.length() > 0 ? new Locale(language, country, variant) : null);
> When locale is "pt_pt", it's result "pt_PT_pt", I think so it's not a variant.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira