natecavanaugh/liferay-portal — pull request #1162 by moltam89 (2013-05-06 13:10:15+00:00)
Title: [TECHNICAL-SUPPORT] LPS-34842 Polls Display portlet & Polls control panel - Percentage field contains extra spcace on French locales (fr_CA, fr_FR) 

Hi Nate,

I'm copying Tibor's comment here:

The problem is NumberFormat formats the arguments based on the locale in which it was instantiated for.
In French locales, there will be an extra space between the digits and the symbols for percentage.

You can test it easily by creating this simple Java class:

package com.liferay.mytest;

import java.text.NumberFormat;
import java.util.Locale;

public class Main {

public static void main(String args[]) {

NumberFormat enFormat = NumberFormat.getPercentInstance(
Locale.ENGLISH);

NumberFormat frFormat = NumberFormat.getPercentInstance(
Locale.FRENCH);

double percent = 0.53;

// output: 53%
System.out.println(enFormat.format(percent));

// output: 53 %
System.out.println(frFormat.format(percent));
}

}

Unfortunately, I couldn't find a way to avoid this format, so I've added a new CSS class to the main.css files of Polls & Polls Display portlets to prevent wrapping (line-break) these values because of the extra spaces.

I've applied it to both "percentFormat.format(votesPercent)" & "numberFormat.format(choiceVotes)", because the latter one also can be problematic, if there are at least 1000 votes, and the "thousand" separator is space, e.g. "1 0000"

Tamás