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:23:17 UTC

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

haiwei li created LANG-889:
------------------------------

             Summary: 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. 
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