Details
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().
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().