Explorar o código

Escape apostrophes

"The java.text.MessageFormat class uses the apostrophe (\u0027) as an escape character. Consequently, you need to write two consecutive apostrophes in your translation if you wish to display a single apostrophe"
lol768 %!s(int64=10) %!d(string=hai) anos
pai
achega
de38826897
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/main/java/com/gmail/nossr50/locale/LocaleLoader.java

+ 1 - 1
src/main/java/com/gmail/nossr50/locale/LocaleLoader.java

@@ -57,7 +57,7 @@ public final class LocaleLoader {
     public static String formatString(String string, Object... messageArguments) {
         if (messageArguments != null) {
             MessageFormat formatter = new MessageFormat("");
-            formatter.applyPattern(string);
+            formatter.applyPattern(string.replace("'", "''"));
             string = formatter.format(messageArguments);
         }