labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r792950 - /labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java
Date Fri, 10 Jul 2009 13:44:45 GMT
Author: simoneg
Date: Fri Jul 10 13:44:44 2009
New Revision: 792950

URL: http://svn.apache.org/viewvc?rev=792950&view=rev
Log:
Easier i18n normalization

Modified:
    labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java

Modified: labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java?rev=792950&r1=792949&r2=792950&view=diff
==============================================================================
--- labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java
(original)
+++ labs/magma/trunk/foundation-i18n/src/main/java/org/apache/magma/i18n/LocaleHolder.java
Fri Jul 10 13:44:44 2009
@@ -153,20 +153,20 @@
 	 */
 	public static String normalize(String original) {
 		StringBuffer sb = new StringBuffer(original.toLowerCase());
-		if (sb.length() > 30) {
-			int add = sb.length() - 30;
-			sb.delete(30, sb.length() - 1);
-			sb.append('+');
-			sb.append(Integer.toString(add));
-		}
 		for (int i = 0; i < sb.length(); i++) {
 			if (sb.charAt(i) == '{' || sb.charAt(i) == '}') {
 				sb.setCharAt(i, '_');				
-			} else if (!Character.isJavaIdentifierPart(sb.charAt(i))) {
+			} else if (!Character.isLetterOrDigit(sb.charAt(i))) {
 				sb.deleteCharAt(i);
 				i--;
 			}
 		}
+		if (sb.length() > 30) {
+			int add = sb.length() - 30;
+			sb.delete(30, sb.length() - 1);
+			sb.append('+');
+			sb.append(Integer.toString(add));
+		}
 		return sb.toString();
 	}
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message