Fixes Issue 0025493: Prevent unwanted translation of literals.
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Mon, 27 Jan 2014 15:55:02 +0530
changeset 21877 dd222399853e
parent 21876 9b47b9cdf8c1
child 21878 cf81ea534d47
Fixes Issue 0025493: Prevent unwanted translation of literals.

If a report using a literal and if the literal is already translated,
then the literal is replaced by the translated value.
Preventing that by adding values to the resultmap only if it did not exist.
src-core/src/org/openbravo/uiTranslation/TranslationUtils.java
--- a/src-core/src/org/openbravo/uiTranslation/TranslationUtils.java	Mon Jan 27 16:03:14 2014 +0100
+++ b/src-core/src/org/openbravo/uiTranslation/TranslationUtils.java	Mon Jan 27 15:55:02 2014 +0530
@@ -183,7 +183,8 @@
       TextInterfacesData[] textData = TextInterfacesData.selectText(conn, fileName, language);
       for (int i = 0; i < textData.length; i++) {
         // trim values, in some occasions there is a character 160 representing blank spaces
-        textmap.put(textData[i].text.replace((char) 160, ' ').trim(), textData[i].trltext);
+        if (!textmap.containsKey(textData[i].text.replace((char) 160, ' ').trim()))
+          textmap.put(textData[i].text.replace((char) 160, ' ').trim(), textData[i].trltext);
       }
       return textmap;
     } catch (ServletException e) {
@@ -191,5 +192,4 @@
     }
     return textmap;
   }
-
 }