[freenet-cvs] r12533 - trunk/plugins/TranslationHelper

nextgens at freenetproject.org nextgens at freenetproject.org
Mon Apr 2 23:35:37 UTC 2007


Author: nextgens
Date: 2007-04-02 23:35:36 +0000 (Mon, 02 Apr 2007)
New Revision: 12533

Modified:
   trunk/plugins/TranslationHelper/TranslationHelper.java
Log:
TranslationHelper: now french unicode characters are looking "normal"; It's a hack wich probably won't work with other encodings.

Modified: trunk/plugins/TranslationHelper/TranslationHelper.java
===================================================================
--- trunk/plugins/TranslationHelper/TranslationHelper.java	2007-04-02 21:40:49 UTC (rev 12532)
+++ trunk/plugins/TranslationHelper/TranslationHelper.java	2007-04-02 23:35:36 UTC (rev 12533)
@@ -92,10 +92,26 @@
 				contentRow.addChild("td", "class", "translation-orig",
 						L10n.getDefaultString(key)
 				);
+				String newValue = editedProperties.getProperty(key);
+				
+				// Deal with unicode characters:
+				// It works for french characters: I'm not sure about others.
+				StringBuffer sb = new StringBuffer();
+				int index = 0;
+				while (index <= newValue.length() - 1) {
+					if(newValue.charAt(index) == (char)195) { // unicode marker
+						char generatedChar = (char)((195 & 11110000) + (newValue.charAt(index + 1)));
+						sb.append(generatedChar);
+						index++;
+					}else
+						sb.append(newValue.charAt(index));
+					index++;
+				}
+
 				contentRow.addChild("td", "class", "translation-new").addChild(
 						"input",
 						new String[] { "type", "name", "value" },
-						new String[] { "text", key, editedProperties.getProperty(key) 
+						new String[] { "text", key,  sb.toString()
 				});
 			}
 			HTMLNode contentRow = legendTable.addChild("tr");




More information about the cvs mailing list