DisplayTag
  1. DisplayTag
  2. DISPL-564

Page numbers localized using wrong locale

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.2
    • Component/s: I18N
    • Labels:
      None

      Description

      Localization fails on page numbers because MessageFormating uses default locale of the system instead of user's locale. This leads to quite confucing resuilts, as 1,456 (over thousand rows) means actually 1.456 in Finnish.

      Fixing this comes down to

      org.displaytag.pagination.Pagination#243:

      if (page.getSelected())
      {
              buffer.append(MessageFormat.format(numberedPageSelectedFormat, pageObjects));
      }
      else
      {
              buffer.append(MessageFormat.format(numberedPageFormat, pageObjects));
      }

      which should be something like:

      if (page.getSelected())
      {
              buffer.append(new MessageFormat(numberedPageSelectedFormat, getUserLocale()).format(pageObjects));
      }
      else
      {
              buffer.append(new MessageFormat(numberedPageFormat, getUserLocale()).format(pageObjects));
      }

      In which getUserLocale() returns the same locale that TableProperties.getLocale().

        Activity

        Hide
        fabrizio giustina added a comment -
        solved in 1.2
        Show
        fabrizio giustina added a comment - solved in 1.2
        Hide
        Hilde Meuris added a comment -
        This problem has only been solved partially: it is also needed to make similar changes in PaginatedListSmartListHelper.java (line 206) and in SmartListHelper.java (line 289).
        Show
        Hilde Meuris added a comment - This problem has only been solved partially: it is also needed to make similar changes in PaginatedListSmartListHelper.java (line 206) and in SmartListHelper.java (line 289).
        Hide
        Hilde Meuris added a comment -
        As you can see, the values between [Eerste/Vorige] and [Volgende/Laatste] are formatted correctly (locale nl_BE), but the other values are still in American formatting.
        Show
        Hilde Meuris added a comment - As you can see, the values between [Eerste/Vorige] and [Volgende/Laatste] are formatted correctly (locale nl_BE), but the other values are still in American formatting.

          People

          • Reporter:
            Samppa Saarela
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: