Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 6670)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 6671)
@@ -53,4 +53,5 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.ColorHelper;
+import org.openstreetmap.josm.tools.I18n;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -836,5 +837,5 @@
             Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o);
             if (m.matches()) {
-                return tr("Paint style {0}: {1}", tr(m.group(1)), tr(m.group(2)));
+                return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2))));
             }
         } catch (Exception e) {
@@ -844,10 +845,10 @@
             Matcher m = Pattern.compile("layer (.+)").matcher(o);
             if (m.matches()) {
-                return tr("Layer: {0}", tr(m.group(1)));
+                return tr("Layer: {0}", tr(I18n.escape(m.group(1))));
             }
         } catch (Exception e) {
             Main.warn(e);
         }
-        return tr(colornames.containsKey(o) ? colornames.get(o) : o);
+        return tr(I18n.escape(colornames.containsKey(o) ? colornames.get(o) : o));
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy	(revision 6671)
+++ /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.groovy	(revision 6671)
@@ -0,0 +1,14 @@
+package org.openstreetmap.josm.data
+
+import org.openstreetmap.josm.Main
+
+class PreferencesTest extends GroovyTestCase {
+    @Override
+    void setUp() {
+        Main.initApplicationPreferences()
+    }
+
+    void testColorName() {
+        Main.pref.getColorName("color.layer {5DE308C0-916F-4B5A-B3DB-D45E17F30172}.gpx") == "{5DE308C0-916F-4B5A-B3DB-D45E17F30172}.gpx"
+    }
+}
Index: /trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.groovy
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.groovy	(revision 6671)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.groovy	(revision 6671)
@@ -0,0 +1,10 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.tools
+
+class I18nTest extends GroovyTestCase {
+    void testEscape() {
+        def foobar = "{foo'bar}"
+        assert I18n.escape(foobar) == "'{'foo''bar'}'"
+        assert I18n.tr(I18n.escape(foobar)) == foobar
+    }
+}
