Revision: 4623
          http://sourceforge.net/p/jump-pilot/code/4623
Author:   edso
Date:     2015-12-14 18:39:48 +0000 (Mon, 14 Dec 2015)
Log Message:
-----------
fixing Malayalam File menu broken

"
Exception in thread "AWT-EventQueue-0" 
java.lang.ArrayIndexOutOfBoundsException: 280
    at 
sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:814)
    at 
sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
    at 
sun.font.ExtendedTextSourceLabel.getCharX(ExtendedTextSourceLabel.java:357)
..."

issue was a trailing space in the translations

streamline I18N.get() to also use getMessage()

Modified Paths:
--------------
    core/trunk/src/com/vividsolutions/jump/I18N.java

Modified: core/trunk/src/com/vividsolutions/jump/I18N.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/I18N.java    2015-12-14 17:42:19 UTC 
(rev 4622)
+++ core/trunk/src/com/vividsolutions/jump/I18N.java    2015-12-14 18:39:48 UTC 
(rev 4623)
@@ -346,7 +346,7 @@
    *         found, returns a default string which is the last part of the 
label
    */
   public static String get(final String label) {
-    return getInstance().getText(label);
+    return getMessage((Object)null,label);
   }
 
   /**
@@ -415,11 +415,18 @@
    * @return i18n label
    */
   private static String getMessage(final Object categoryPrefixOrPath,
-      final String label, final Object[] objects) {
+      final String label, final Object... objects) {
     I18N i18n = categoryPrefixOrPath != null ? 
getInstance(categoryPrefixOrPath)
         : getInstance();
     try {
-      final MessageFormat mformat = new MessageFormat(i18n.getText(label));
+      // IMPORTANT: trailing spaces break the Malayalam translation, 
+      //            so we trim here, just to make sure
+      String text = i18n.getText(label).trim();
+      // no params, nothing to parse
+      if ( objects.length < 1 )
+        return text;
+      // parse away
+      final MessageFormat mformat = new MessageFormat(text);
       return mformat.format(objects);
     } catch (java.util.MissingResourceException e) {
       final String[] labelpath = label.split("\\.");


------------------------------------------------------------------------------
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to