United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6547501 There should be a space before % sign in French locale
JDK-6547501 : There should be a space before % sign in French locale

Details
Type:
Bug
Submit Date:
2007-04-18
Status:
Resolved
Updated Date:
2010-05-08
Project Name:
JDK
Resolved Date:
2007-06-30
Component:
globalization
OS:
windows_xp
Sub-Component:
translation
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0u11
Fixed Versions:
6u4 (b01)

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
J2SE Version (please include all output from java -version flag):
V:\>java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)


Does this problem occur on J2SE 1.4.x or 5.0.x ?  
Yes (5.0.x)


Operating System Configuration Information (be specific):
Win XP Pro, Redhat5


Hardware Configuration Information (be specific):
N/A


Bug Description:
Using NumberFormat.getPercentageInstance() with a french locale will output the percentage and the %, but there is no space between them.  Our localization team indicated that, for example, "50%" should be displayed as "50 %" in french locales.


Steps to Reproduce (be specific):

(CODE)

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

public class TestLocale {

    public static void main( String argv[] ) {
    	
    	int numerator = 1;
    	int denominator = 2;
    	

        Locale english = new Locale( "EN", "US", "" );
        Locale french = new Locale( "FR", "FR", "" );
        NumberFormat englishFormatter = NumberFormat.getPercentInstance(english);
        NumberFormat frenchFormatter = NumberFormat.getPercentInstance(french);
		
        if (denominator == 0) {
			System.out.println(english + ": " + englishFormatter.format(0));
			System.out.println(french + ": " + frenchFormatter.format(0));
		} else {
			System.out.println(english + ": " + englishFormatter.format(numerator/(double)denominator));
			System.out.println(french + ": " + frenchFormatter.format(numerator/(double)denominator));
		}
        
    }
}

(OUTPUT)
en_US: 50%
fr_FR: 50%

                                    

Comments
EVALUATION

jiri should be able to handle this. Add a keyword ur603-l10n only for tracking, not meaning the bug should be fixed in 6u3. The detail decision will be made by Jiri.
                                     
2007-04-19
EVALUATION

According to the CLDR all the french "sublocales" should use the same format of percent.
Therefore fixing:
j2se:src/share/classes/sun/text/resources
FormatData_fr.java
------- FormatData_fr.java -------
101c101
<                     "#,##0%" // percent pattern
---
>                     "#,##0 %" // percent pattern
FormatData_fr_CA.java
------- FormatData_fr_CA.java -------
39c39
<                     "#,##0%" // percent pattern
---
>                     "#,##0 %" // percent pattern
FormatData_fr_CH.java
------- FormatData_fr_CH.java -------
39c39
<                     "#,##0%" // percent pattern
---
>                     "#,##0 %" // percent pattern

test:
j2se:test/sun/text/resources/LocaleDataTest.java
j2se:test/sun/text/resources/LocaleData
------- LocaleData -------
2213c2213,2214
< FormatData/fr/NumberPatterns/2=#,##0%
---
> # changed, see bug 6547501
> FormatData/fr/NumberPatterns/2=#,##0 %
2218c2219,2220
< FormatData/fr_FR/NumberPatterns/2=#,##0%
---
> # changed, see bug 6547501
> FormatData/fr_FR/NumberPatterns/2=#,##0 %
5436a5439,5466
> # bug 6547501, some of the tests might be duplicated in this datafile.
> FormatData/fr/NumberPatterns/2=#,##0 %
> FormatData/fr_BE/NumberPatterns/2=#,##0 %
> FormatData/fr_CA/NumberPatterns/2=#,##0 %
> FormatData/fr_CH/NumberPatterns/2=#,##0 %
> FormatData/fr_FR/NumberPatterns/2=#,##0 %
> FormatData/fr_LU/NumberPatterns/2=#,##0 %
                                     
2007-05-28



Hardware and Software, Engineered to Work Together