[Schmitzm-commits] r822 - trunk/src/skrueger/i8n

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun May 2 21:00:12 CEST 2010


Author: alfonx
Date: 2010-05-02 21:00:12 +0200 (Sun, 02 May 2010)
New Revision: 822

Modified:
   trunk/src/skrueger/i8n/I8NUtil.java
Log:
Neue Methode um ae und ue in ?\195?\164 und ?\195?\188 umzuwandeln etc.

Modified: trunk/src/skrueger/i8n/I8NUtil.java
===================================================================
--- trunk/src/skrueger/i8n/I8NUtil.java	2010-04-24 16:19:42 UTC (rev 821)
+++ trunk/src/skrueger/i8n/I8NUtil.java	2010-05-02 19:00:12 UTC (rev 822)
@@ -158,10 +158,10 @@
 	 */
 	public static double qmTranslation(final List<String> languages,
 			final Translation trans) {
-	
+
 		if (trans == null)
 			return 0.;
-	
+
 		Integer cunt = 0;
 		for (final String l : languages) {
 			final String t = trans.get(l);
@@ -170,4 +170,18 @@
 		}
 		return cunt.doubleValue() / (double) languages.size();
 	}
+
+	/**
+	 * The German Umlaute have standard ASCII alternatives that are sometimes
+	 * use. This method will replace any possible ASCII-Umlaut Representation
+	 * into real Umlaute. E.g. "ae" to "ä" and "ue" to "ü"
+	 */
+	public static String mitUmlaute(String withoutUmlaute) {
+		String replaced = withoutUmlaute.replaceAll("ae", "ä");
+		replaced = replaced.replaceAll("ue", "ü");
+		replaced = replaced.replaceAll("oe", "ö");
+		// TODO mehr
+		// TODO besser UTF \u123321 schreibweise
+		return replaced;
+	}
 }



More information about the Schmitzm-commits mailing list