Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-14076

DoubleConverter / NumberCFType is not as I18N as it could / should be - decimal separator does not respect user's locale

XMLWordPrintable

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      The current implementation of DoubleConverter hard codes a decimal separator of period '.'

      This doesnt work in locations that use comma ',' as the decimal separator.

      We should not hard code the call to setDecimalSeparator especially for the display format.

      public class DoubleConverter
      {
          private static final DecimalFormat DISPLAY_FORMAT;
          static
          {
              DISPLAY_FORMAT = new DecimalFormat();
              DISPLAY_FORMAT.setGroupingUsed(false);
              DISPLAY_FORMAT.setMinimumFractionDigits(0);
              DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
              formatSymbols.setDecimalSeparator('.');
              DISPLAY_FORMAT.setDecimalFormatSymbols(formatSymbols);
          }
      
          private static final DecimalFormat LUCENE_FORMAT;
          static
          {
              LUCENE_FORMAT = new DecimalFormat();
              LUCENE_FORMAT.setGroupingUsed(false);
              LUCENE_FORMAT.setMinimumIntegerDigits(14);
              LUCENE_FORMAT.setMaximumIntegerDigits(14);
              LUCENE_FORMAT.setMinimumFractionDigits(3);
              LUCENE_FORMAT.setMaximumFractionDigits(3);
              DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
              formatSymbols.setDecimalSeparator('.');
              LUCENE_FORMAT.setDecimalFormatSymbols(formatSymbols);
          }
      ...
      ...
      

            pniewiadomski Pawel Niewiadomski (Inactive)
            bbaker ɹǝʞɐq pɐɹq
            Votes:
            12 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: