Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Number format is differed from language to language.

    Hi Isomorphic,
    We are using Smart Gwt-5.1 (15th February build)
    Browser: Google Chrome, version: 47.0.2526.106 m

    Issue: Number format is differed from language to language.

    We have a requirement like formatting number values into 'mm'(Millimeter). We followed two methods to format the number values. We observed that few languages like "French, German and Spanish" dot was replaced with comma.

    Below is the code:

    Method#1:
    ----------------------------------------
    import com.google.gwt.i18n.client.NumberFormat;

    Double measurementX = (double) ((112000) / 1000.00));
    NumberFormat nfx = NumberFormat.getFormat("#,##0.00");
    String output = nfx.format(measurementX);


    Output:
    In English: 112.00 >> Correct
    In French: 112,00 >> Wrong (Dot is replaced with comma < 3rd position from right side).
    --------------------------------------



    Method#2:
    ---------------------------------------

    import com.smartgwt.client.util.NumberUtil;

    Double measurementX = (double) ((112000) / 1000.00));
    String output = NumberUtil.format(measurementX, "#,##0.00");


    Output:
    In English: 112.00 >> Correct
    In French: 112,00 >> Wrong (Dot is replaced with comma < 3rd position from right side).

    --------------------------------------

    Do let me know if any solution available.


    Thanks & Regards,
    Last edited by vnathank; 15 Feb 2016, 04:37.

    #2
    Hi vnathank,

    this is related to i18n / l10n. Did you already see the docs on it?
    What is you goal? Localized framework (and application) messages, but always American date/number formatting? Please note that this might be unexpected / inconvenient for users, where "," actually is the decimal separator.

    Best regards
    Blama

    Comment

    Working...
    X