weaver 2005/03/11 12:55:55
Modified:
applications/pam/src/java/org/apache/jetspeed/portlets/localeselector
LocaleSelectorPortlet.java
Log:
Added ability to handle both delimiter formats
Revision Changes Path
1.3 +17 -13
jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
Index: LocaleSelectorPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocaleSelectorPortlet.java 4 Jan 2005 15:50:16 -0000 1.2
+++ LocaleSelectorPortlet.java 11 Mar 2005 20:55:55 -0000 1.3
@@ -78,21 +78,25 @@
if (language != null)
{
+ String[] localeArray = language.split("[-|_]");
String country = "";
String variant = "";
- int countryIndex = language.indexOf('_');
- if (countryIndex > -1)
- {
- country = language.substring(countryIndex + 1).trim();
- language = language.substring(0, countryIndex).trim();
- int vDash = country.indexOf("_");
- if (vDash > 0)
- {
- String cTemp = country.substring(0, vDash);
- variant = country.substring(vDash + 1);
- country = cTemp;
- }
- }
+ for(int i=0; i<localeArray.length; i++)
+ {
+ if(i == 0)
+ {
+ language = localeArray[i];
+ }
+ else if(i == 1)
+ {
+ country = localeArray[i];
+ }
+ else if(i == 2)
+ {
+ variant = localeArray[i];
+ }
+ }
+
// TODO Set the prefered locale to user's persistent storage if
not anon user
Locale preferedLocale = new Locale(language, country, variant);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]