You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 18:05:28 UTC

[myfaces-trinidad-maven] 03/05: TRINIDAD-1366 - client percent convertnumber not work well in fr_fr

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.8.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad-maven.git

commit 47c7a564e856194baae0a0dcc56abf58285424af
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Sun Jan 18 23:44:39 2009 +0000

    TRINIDAD-1366 - client percent convertnumber not work well in fr_fr
    
    committed first part of the patch. The i18n plugin needs to generate
    PercentElements in order to support this
---
 .../i18n/uixtools/JSLocaleElementsGenerator.java       | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/maven-i18n-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/i18n/uixtools/JSLocaleElementsGenerator.java b/maven-i18n-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/i18n/uixtools/JSLocaleElementsGenerator.java
index b6cded9..635897c 100644
--- a/maven-i18n-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/i18n/uixtools/JSLocaleElementsGenerator.java
+++ b/maven-i18n-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/i18n/uixtools/JSLocaleElementsGenerator.java
@@ -415,8 +415,10 @@ public class JSLocaleElementsGenerator
 
         Object data = null;
 
-        if("CurrencyElements".equals(currKey))
+        if ("CurrencyElements".equals(currKey))
           data = _getCurrencyData(targetLocale);
+        else if ("PercentElements".equals(currKey))
+          data = _getPercentData(targetLocale);
         else
           data = LocaleDataResolver.getElementData(currKey, targetLocale);
 
@@ -454,6 +456,19 @@ public class JSLocaleElementsGenerator
 
     return currencyData;
   }
+  
+  private static Object _getPercentData(
+    Locale targetLocale)
+  {
+    DecimalFormat df = (DecimalFormat)NumberFormat.getPercentInstance(targetLocale);
+    Object[] percentData = new Object[2];
+    percentData[0] = df.getPositiveSuffix();
+    percentData[1] = df.getNegativeSuffix();
+    //percentData[2] = df.getPositivePrefix();
+    //percentData[3] = df.getNegativePrefix();  
+
+    return percentData;
+  }
 
   private static Object _getElementData(
     String currKey,
@@ -713,6 +728,7 @@ public class JSLocaleElementsGenerator
     "DateTimeElements",
     "NumberElements",
     "CurrencyElements",
+    "PercentElements"
   };
 
   //

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.