Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update French locales to use U+202F instead of U+00A0 for the number grouping separator #80

Merged
merged 3 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## ICU 68.2.0.x
#### Data changes:
- Update number grouping separator for French locales. [#80](https://github.com/microsoft/icu/pull/80)

## ICU 68.2.0.3
#### General changes:
- Add support for prebuilt Linux ARM64 binaries in the MS-ICU Nuget package. (#70)
- Picked up tzdata 2021a updates. (#76)
- Add support for prebuilt Linux ARM64 binaries in the MS-ICU Nuget package. [#70](https://github.com/microsoft/icu/pull/70)
jefgen marked this conversation as resolved.
Show resolved Hide resolved
- Picked up tzdata 2021a updates. [#76](https://github.com/microsoft/icu/pull/76)

#### Changes cherry-picked from upstream tickets/PRs:

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion icu/icu4c/source/data/locales/fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ fr{
approximatelySign{"≃"}
decimal{","}
exponential{"E"}
group{" "}
jefgen marked this conversation as resolved.
Show resolved Hide resolved
group{""}
infinity{"∞"}
list{";"}
minusSign{"-"}
Expand Down
1 change: 1 addition & 0 deletions icu/icu4c/source/data/locales/fr_CA.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ fr_CA{
}
symbols{
approximatelySign{"≈"}
group{" "}
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions icu/icu4c/source/test/cintltst/cnmdptst.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,10 @@ static void TestCurrencyObject(void)
"JPY",
};

/* MSFT Change: Begin */
const char* result[]={
"1\\u00a0234,56\\u00A0\\u20AC",
daniel-ju marked this conversation as resolved.
Show resolved Hide resolved
"1\\u00a0235\\u00A0JPY",
"1\\u202F234,56\\u00A0\\u20AC",
"1\\u202F235\\u00A0JPY",
};
/* MSFT Change: End */

log_verbose("\nTesting the number format with different currency codes\n");
for(i=0; i < 2; i++)
Expand Down
16 changes: 5 additions & 11 deletions icu/icu4c/source/test/intltest/numbertest_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2874,10 +2874,8 @@ void NumberFormatterApiTest::symbols() {
nullptr,
NumberFormatter::with().symbols(FRENCH_SYMBOLS),
Locale::getJapan(),
/* MSFT Change: Begin */
u"87\u00a0650",
u"8\u00a0765",
/* MSFT Change: End */
u"87\u202F650",
u"8\u202F765",
u"876,5",
u"87,65",
u"8,765",
Expand Down Expand Up @@ -2917,10 +2915,8 @@ void NumberFormatterApiTest::symbols() {
u"numbering-system/mathsanb",
NumberFormatter::with().adoptSymbols(new NumberingSystem(MATHSANB)),
Locale::getFrench(),
/* MSFT Change: Begin */
u"𝟴𝟳\u00a0𝟲𝟱𝟬",
u"𝟴\u00a0𝟳𝟲𝟱",
/* MSFT Change: End */
u"𝟴𝟳\u202F𝟲𝟱𝟬",
u"𝟴\u202F𝟳𝟲𝟱",
u"𝟴𝟳𝟲,𝟱",
u"𝟴𝟳,𝟲𝟱",
u"𝟴,𝟳𝟲𝟱",
Expand Down Expand Up @@ -3549,9 +3545,7 @@ void NumberFormatterApiTest::locale() {
UErrorCode status = U_ZERO_ERROR;
UnicodeString actual = NumberFormatter::withLocale(Locale::getFrench()).formatInt(1234, status)
.toString(status);
/* MSFT Change: Begin */
assertEquals("Locale withLocale()", u"1\u00a0234", actual);
/* MSFT Change: End */
assertEquals("Locale withLocale()", u"1\u202f234", actual);
}

void NumberFormatterApiTest::skeletonUserGuideExamples() {
Expand Down
10 changes: 4 additions & 6 deletions icu/icu4c/source/test/intltest/numbertest_decimalquantity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,18 +483,17 @@ void DecimalQuantityTest::testCompactDecimalSuppressedExponent() {
int32_t expectedSuppressedExponent;
} cases[] = {
// unlocalized formatter skeleton, input, string output, long output, double output, BigDecimal output, plain string, suppressed exponent
/* MSFT Change: Begin */
{u"", 123456789, u"123\u00A0456\u00A0789", 123456789L, 123456789.0, u"123456789", 0},
{u"", 123456789, u"123 456 789", 123456789L, 123456789.0, u"123456789", 0},
{u"compact-long", 123456789, u"123 millions", 123000000L, 123000000.0, u"123000000", 6},
{u"compact-short", 123456789, u"123 M", 123000000L, 123000000.0, u"123000000", 6},
{u"scientific", 123456789, u"1,234568E8", 123456800L, 123456800.0, u"123456800", 8},

{u"", 1234567, u"1\u00A0234\u00A0567", 1234567L, 1234567.0, u"1234567", 0},
{u"", 1234567, u"1 234 567", 1234567L, 1234567.0, u"1234567", 0},
{u"compact-long", 1234567, u"1,2 million", 1200000L, 1200000.0, u"1200000", 6},
{u"compact-short", 1234567, u"1,2 M", 1200000L, 1200000.0, u"1200000", 6},
{u"scientific", 1234567, u"1,234567E6", 1234567L, 1234567.0, u"1234567", 6},

{u"", 123456, u"123\u00A0456", 123456L, 123456.0, u"123456", 0},
{u"", 123456, u"123 456", 123456L, 123456.0, u"123456", 0},
{u"compact-long", 123456, u"123 mille", 123000L, 123000.0, u"123000", 3},
{u"compact-short", 123456, u"123 k", 123000L, 123000.0, u"123000", 3},
{u"scientific", 123456, u"1,23456E5", 123456L, 123456.0, u"123456", 5},
Expand Down Expand Up @@ -524,11 +523,10 @@ void DecimalQuantityTest::testCompactDecimalSuppressedExponent() {
{u"compact-short", 999.9, u"1 k", 1000L, 1000.0, u"1000", 3},
{u"scientific", 999.9, u"9,999E2", 999L, 999.9, u"999.9", 2},

{u"", 1000.0, u"1\u00A0000", 1000L, 1000.0, u"1000", 0},
{u"", 1000.0, u"1 000", 1000L, 1000.0, u"1000", 0},
{u"compact-long", 1000.0, u"1 millier", 1000L, 1000.0, u"1000", 3},
{u"compact-short", 1000.0, u"1 k", 1000L, 1000.0, u"1000", 3},
{u"scientific", 1000.0, u"1E3", 1000L, 1000.0, u"1000", 3},
/* MSFT Change: End */
};
for (const auto& cas : cases) {
// test the helper methods used to compute plural operand values
Expand Down
12 changes: 5 additions & 7 deletions icu/icu4c/source/test/intltest/numbertest_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,11 @@ void NumberRangeFormatterTest::testBasic() {
u"≈5\u00A0degrés Fahrenheit",
u"0–3\u00A0degrés Fahrenheit",
u"≈0\u00A0degré Fahrenheit",
/* MSFT Change: Begin */
u"3–3\u00a0000\u00A0degrés Fahrenheit",
u"3\u00a0000–5\u00a0000\u00A0degrés Fahrenheit",
u"4\u00a0999–5\u00a0001\u00A0degrés Fahrenheit",
u"≈5\u00a0000\u00A0degrés Fahrenheit",
u"5\u00a0000–5\u00a0000\u00a0000\u00A0degrés Fahrenheit");
/* MSFT Change: End */
u"3–3\u202F000\u00A0degrés Fahrenheit",
u"3\u202F000–5\u202F000\u00A0degrés Fahrenheit",
u"4\u202F999–5\u202F001\u00A0degrés Fahrenheit",
u"≈5\u202F000\u00A0degrés Fahrenheit",
u"5\u202F000–5\u202F000\u202F000\u00A0degrés Fahrenheit");

assertFormatRange(
u"Locale with custom range separator",
Expand Down
65 changes: 26 additions & 39 deletions icu/icu4c/source/test/intltest/numfmtspectest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,14 @@ void NumberFormatSpecificationTest::runIndexedTest(
}

void NumberFormatSpecificationTest::TestBasicPatterns() {
/* MSFT Change: Begin */
assertPatternFr("1 234,57", 1234.567, "#,##0.##", TRUE);
assertPatternFr("1\\u202F234,57", 1234.567, "#,##0.##", TRUE);
assertPatternFr("1234,57", 1234.567, "0.##", TRUE);
assertPatternFr("1235", 1234.567, "0", TRUE);
assertPatternFr("1 234,567", 1234.567, "#,##0.###", TRUE);
assertPatternFr("1\\u202F234,567", 1234.567, "#,##0.###", TRUE);
assertPatternFr("1234,567", 1234.567, "###0.#####", TRUE);
assertPatternFr("1234,5670", 1234.567, "###0.0000#", TRUE);
assertPatternFr("01234,5670", 1234.567, "00000.0000", TRUE);
assertPatternFr("1 234,57 \\u20ac", 1234.567, "#,##0.00 \\u00a4", TRUE);
/* MSFT Change: End */
assertPatternFr("1\\u202F234,57 \\u20ac", 1234.567, "#,##0.00 \\u00a4", TRUE);
}

void NumberFormatSpecificationTest::TestNfSetters() {
Expand All @@ -109,10 +107,8 @@ void NumberFormatSpecificationTest::TestNfSetters() {
}
nf->setMaximumIntegerDigits(5);
nf->setMinimumIntegerDigits(4);
/* MSFT Change: Begin */
assertEquals("", u"34 567,89", format(1234567.89, *nf), TRUE);
assertEquals("", u"0 034,56", format(34.56, *nf), TRUE);
/* MSFT Change: End */
assertEquals("", u"34\u202F567,89", format(1234567.89, *nf), TRUE);
assertEquals("", u"0\u202F034,56", format(34.56, *nf), TRUE);
}

void NumberFormatSpecificationTest::TestRounding() {
Expand All @@ -125,23 +121,20 @@ void NumberFormatSpecificationTest::TestRounding() {
assertPatternFr("8", 10.0, "4", TRUE);
assertPatternFr("99,90", 99.0, "2.70", TRUE);
assertPatternFr("273,00", 272.0, "2.73", TRUE);
/* MSFT Change: Begin */
assertPatternFr("1 03,60", 104.0, "#,#3.70", TRUE);
/* MSFT Change: End */
assertPatternFr("1\\u202F03,60", 104.0, "#,#3.70", TRUE);
}

void NumberFormatSpecificationTest::TestSignificantDigits() {
/* MSFT Change: Begin */
assertPatternFr("1 234", 1234.0, "@,@@@", TRUE);
assertPatternFr("1 235 000", 1234567.0, "@,@@@", TRUE);
assertPatternFr("1 234 567", 1234567.0, "@@@@,@@@", TRUE);
assertPatternFr("12 34 567,00", 1234567.0, "@@@@,@@,@@@", TRUE);
assertPatternFr("12 34 567,0", 1234567.0, "@@@@,@@,@@#", TRUE);
assertPatternFr("12 34 567", 1234567.0, "@@@@,@@,@##", TRUE);
assertPatternFr("12 34 567", 1234567.001, "@@@@,@@,@##", TRUE);
assertPatternFr("12 34 567", 1234567.001, "@@@@,@@,###", TRUE);
assertPatternFr("1 200", 1234.0, "#,#@@", TRUE);
/* MSFT Change: End */
assertPatternFr("1230", 1234.0, "@@@", TRUE);
assertPatternFr("1\\u202F234", 1234.0, "@,@@@", TRUE);
assertPatternFr("1\\u202F235\\u202F000", 1234567.0, "@,@@@", TRUE);
assertPatternFr("1\\u202F234\\u202F567", 1234567.0, "@@@@,@@@", TRUE);
assertPatternFr("12\\u202F34\\u202F567,00", 1234567.0, "@@@@,@@,@@@", TRUE);
assertPatternFr("12\\u202F34\\u202F567,0", 1234567.0, "@@@@,@@,@@#", TRUE);
assertPatternFr("12\\u202F34\\u202F567", 1234567.0, "@@@@,@@,@##", TRUE);
assertPatternFr("12\\u202F34\\u202F567", 1234567.001, "@@@@,@@,@##", TRUE);
assertPatternFr("12\\u202F34\\u202F567", 1234567.001, "@@@@,@@,###", TRUE);
assertPatternFr("1\\u202F200", 1234.0, "#,#@@", TRUE);
}

void NumberFormatSpecificationTest::TestScientificNotation() {
Expand All @@ -166,10 +159,8 @@ void NumberFormatSpecificationTest::TestPercent() {
assertPatternFr("p%p57,3", 0.573, "p%p0.0", TRUE);
assertPatternFr("p%p0,6", 0.573, "p'%'p0.0", TRUE);
assertPatternFr("%3,260", 0.0326, "%@@@@", TRUE);
/* MSFT Change: Begin */
assertPatternFr("%1 540", 15.43, "%#,@@@", TRUE);
assertPatternFr("%1 656,4", 16.55, "%#,##4.1", TRUE);
/* MSFT Change: End */
assertPatternFr("%1\\u202F540", 15.43, "%#,@@@", TRUE);
assertPatternFr("%1\\u202F656,4", 16.55, "%#,##4.1", TRUE);
assertPatternFr("%16,3E3", 162.55, "%##0.00E0", TRUE);
}

Expand All @@ -179,22 +170,18 @@ void NumberFormatSpecificationTest::TestPerMilli() {
assertPatternFr("p\\u2030p573,0", 0.573, "p\\u2030p0.0", TRUE);
assertPatternFr("p\\u2030p0,6", 0.573, "p'\\u2030'p0.0", TRUE);
assertPatternFr("\\u203032,60", 0.0326, "\\u2030@@@@", TRUE);
/* MSFT Change: Begin */
assertPatternFr("\\u203015 400", 15.43, "\\u2030#,@@@", TRUE);
assertPatternFr("\\u203016 551,7", 16.55, "\\u2030#,##4.1", TRUE);
/* MSFT Change: End */
assertPatternFr("\\u203015\\u202F400", 15.43, "\\u2030#,@@@", TRUE);
assertPatternFr("\\u203016\\u202F551,7", 16.55, "\\u2030#,##4.1", TRUE);
assertPatternFr("\\u2030163E3", 162.55, "\\u2030##0.00E0", TRUE);
}

void NumberFormatSpecificationTest::TestPadding() {
/* MSFT Change: Begin */
assertPatternFr("$***1 234", 1234, "$**####,##0", TRUE);
assertPatternFr("xxx$1 234", 1234, "*x$####,##0", TRUE);
assertPatternFr("1 234xxx$", 1234, "####,##0*x$", TRUE);
assertPatternFr("1 234$xxx", 1234, "####,##0$*x", TRUE);
assertPatternFr("ne1 234nx", -1234, "####,##0$*x;ne#n", TRUE);
assertPatternFr("n1 234*xx", -1234, "####,##0$*x;n#'*'", TRUE);
/* MSFT Change: End */
assertPatternFr("$***1\\u202F234", 1234, "$**####,##0", TRUE);
assertPatternFr("xxx$1\\u202F234", 1234, "*x$####,##0", TRUE);
assertPatternFr("1\\u202F234xxx$", 1234, "####,##0*x$", TRUE);
assertPatternFr("1\\u202F234$xxx", 1234, "####,##0$*x", TRUE);
assertPatternFr("ne1\\u202F234nx", -1234, "####,##0$*x;ne#n", TRUE);
assertPatternFr("n1\\u202F234*xx", -1234, "####,##0$*x;n#'*'", TRUE);
assertPatternFr("yyyy%432,6", 4.33, "*y%4.2######", TRUE);
assertPatternFr("EUR *433,00", 433.0, "\\u00a4\\u00a4 **####0.00");
assertPatternFr("EUR *433,00", 433.0, "\\u00a4\\u00a4 **#######0");
Expand Down
12 changes: 5 additions & 7 deletions icu/icu4c/source/test/intltest/numfmtst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,21 +1024,19 @@ void NumberFormatTest::TestCurrencyObject() {
return;
}

/* MSFT Change: Begin */
expectCurrency(*fmt, null, 1234.56, CharsToUnicodeString("1 234,56 \\u20AC"));
expectCurrency(*fmt, null, 1234.56, CharsToUnicodeString("1\\u202F234,56 \\u20AC"));

expectCurrency(*fmt, Locale::getJapan(),
1234.56, CharsToUnicodeString("1 235 JPY")); // Yen
1234.56, CharsToUnicodeString("1\\u202F235 JPY")); // Yen

expectCurrency(*fmt, Locale("fr", "CH", ""),
1234.56, CharsToUnicodeString("1 234,56 CHF")); // no more 0.05 rounding here, see cldrbug 5548
1234.56, CharsToUnicodeString("1\\u202F234,56 CHF")); // no more 0.05 rounding here, see cldrbug 5548

expectCurrency(*fmt, Locale::getUS(),
1234.56, CharsToUnicodeString("1 234,56 $US"));
1234.56, CharsToUnicodeString("1\\u202F234,56 $US"));

expectCurrency(*fmt, Locale::getFrance(),
1234.56, CharsToUnicodeString("1 234,56 \\u20AC")); // Euro
/* MSFT Change: End */
1234.56, CharsToUnicodeString("1\\u202F234,56 \\u20AC")); // Euro

delete fmt;
}
Expand Down
28 changes: 10 additions & 18 deletions icu/icu4c/source/test/intltest/numrgts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,10 @@ void NumberFormatRegressionTest::Test4086575(void)
logln("...applyLocalizedPattern # ###,00;(# ###,00) ");
// nbsp = \u00a0
//nf->applyLocalizedPattern("#\u00a0###,00;(#\u00a0###,00)");
/* MSFT Change: Begin */
UChar patChars[] = {
0x23, 0x00a0, 0x23, 0x23, 0x23, 0x2c, 0x30, 0x30, 0x3b,
0x28, 0x23, 0x00a0, 0x23, 0x23, 0x23, 0x2c, 0x30, 0x30, 0x29
0x23, 0x202f, 0x23, 0x23, 0x23, 0x2c, 0x30, 0x30, 0x3b,
0x28, 0x23, 0x202f, 0x23, 0x23, 0x23, 0x2c, 0x30, 0x30, 0x29
};
/* MSFT Change: End */
UnicodeString pat(patChars, 19, 19);
nf->applyLocalizedPattern(pat, status);
failure(status, "nf->applyLocalizedPattern", Locale::getFrance());
Expand All @@ -562,22 +560,18 @@ void NumberFormatRegressionTest::Test4086575(void)
UnicodeString buffer;
buffer = nf->format((int32_t)1234, buffer, pos);
//if (buffer != UnicodeString("1\u00a0234,00"))
/* MSFT Change: Begin */
UChar c[] = {
0x31, 0x00a0, 0x32, 0x33, 0x34, 0x2c, 0x30, 0x30
0x31, 0x202f, 0x32, 0x33, 0x34, 0x2c, 0x30, 0x30
};
/* MSFT Change: End */
UnicodeString cc(c, 8, 8);
if (buffer != cc)
errln("nf : " + buffer); // Expect 1 234,00

buffer.remove();
buffer = nf->format((int32_t)-1234, buffer, pos);
/* MSFT Change: Begin */
UChar c1[] = {
0x28, 0x31, 0x00a0, 0x32, 0x33, 0x34, 0x2c, 0x30, 0x30, 0x29
0x28, 0x31, 0x202f, 0x32, 0x33, 0x34, 0x2c, 0x30, 0x30, 0x29
};
/* MSFT Change: End */
UnicodeString cc1(c1, 10, 10);
if (buffer != cc1)
errln("nf : " + buffer); // Expect (1 234,00)
Expand Down Expand Up @@ -902,22 +896,20 @@ void NumberFormatRegressionTest::Test4070798 (void)
NumberFormat *formatter;
UnicodeString tempString;

/* MSFT Change: Begin */
/* User error :
String expectedDefault = "-5\u00a0789,987";
String expectedCurrency = "5\u00a0789,98\u00a0F";
String expectedPercent = "-578\u00a0998%";
String expectedDefault = "-5\u202f789,987";
String expectedCurrency = "5\u202f789,98\u00a0F";
String expectedPercent = "-578\u202f998%";
*/
UChar chars1 [] = {
0x2d, 0x35, 0x00a0, 0x37, 0x38, 0x39, 0x2c, 0x39, 0x38, 0x38
0x2d, 0x35, 0x202f, 0x37, 0x38, 0x39, 0x2c, 0x39, 0x38, 0x38
};
UChar chars2 [] = {
0x35, 0x00a0, 0x37, 0x38, 0x39, 0x2c, 0x39, 0x39, 0x00a0, 0x46
0x35, 0x202f, 0x37, 0x38, 0x39, 0x2c, 0x39, 0x39, 0x00a0, 0x46
};
UChar chars3 [] = {
0x2d, 0x35, 0x37, 0x38, 0x00a0, 0x39, 0x39, 0x39, 0x00a0, 0x25
0x2d, 0x35, 0x37, 0x38, 0x202f, 0x39, 0x39, 0x39, 0x00a0, 0x25
};
/* MSFT Change: End */
UnicodeString expectedDefault(chars1, 10, 10);
UnicodeString expectedCurrency(chars2, 10, 10);
UnicodeString expectedPercent(chars3, 10, 10);
Expand Down
6 changes: 2 additions & 4 deletions icu/icu4c/source/test/intltest/tsmthred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,13 @@ class FormatThreadTest : public SimpleThread
// Keep this data here to avoid static initialization.
FormatThreadTestData kPercentFormatTestData[] =
{
/* MSFT Change: Begin */
FormatThreadTestData((double)5.0, CharsToUnicodeString("500\\u00a0%")),
FormatThreadTestData( 1.0, CharsToUnicodeString("100\\u00a0%")),
FormatThreadTestData( 0.26, CharsToUnicodeString("26\\u00a0%")),
FormatThreadTestData(
16384.99, CharsToUnicodeString("1\\u00a0638\\u00a0499\\u00a0%")), // U+202F = NNBSP, U+00A0 = NBSP
16384.99, CharsToUnicodeString("1\\u202F638\\u202F499\\u00a0%")), // U+202F = NNBSP
FormatThreadTestData(
81890.23, CharsToUnicodeString("8\\u00a0189\\u00a0023\\u00a0%")),
/* MSFT Change: End */
81890.23, CharsToUnicodeString("8\\u202F189\\u202F023\\u00a0%")),
};
int32_t kPercentFormatTestDataLength = UPRV_LENGTHOF(kPercentFormatTestData);
int32_t iteration;
Expand Down
Loading