abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r600243 - /incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java
Date Sun, 02 Dec 2007 05:19:07 GMT
Author: jmsnell
Date: Sat Dec  1 21:19:06 2007
New Revision: 600243

URL: http://svn.apache.org/viewvc?rev=600243&view=rev
Log:
Tweak the bidi formatted output of the template so that the arg is always displayed in logical
order (LTR).

Modified:
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java?rev=600243&r1=600242&r2=600243&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java
(original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/templates/Template.java
Sat Dec  1 21:19:06 2007
@@ -81,7 +81,7 @@
         token, 
         forDisplay(token));
     }
-    return CharUtils.bidiLRM(pattern);
+    return CharUtils.bidiLRE(pattern);
   }
   
   private static String forDisplay(String token) {
@@ -89,13 +89,28 @@
     StringBuilder buf = new StringBuilder();
     buf.append('{');
     if (splits.length == 1) {
-      buf.append(CharUtils.bidiLRM(splits[0]));
+      String[] pair = splits[0].split("\\s*=\\s*");
+      buf.append(CharUtils.bidiLRM(pair[0]));
+      if (pair.length > 1) {
+        buf.append('=');
+        buf.append(CharUtils.bidiLRO(pair[1]));
+      }
     } else {
       buf.append(splits[0]);
       buf.append('|');
       buf.append(CharUtils.bidiLRO(splits[1]));
       buf.append('|');
-      buf.append(CharUtils.bidiLRM(splits[2]));
+      String[] vars = splits[2].split("\\s*,\\s*");
+      int i = 0;
+      for (String var : vars) {
+        if (i++ > 0) buf.append(",");
+        String[] pair = var.split("\\s*=\\s*");
+        buf.append(CharUtils.bidiLRM(pair[0]));
+        if (pair.length > 1) {
+          buf.append('=');
+          buf.append(CharUtils.bidiLRO(pair[1]));
+        }
+      }
     }
     buf.append('}');
     return buf.toString();



Mime
View raw message