nl_NL locale: Correct the negative monetary format (bug 24614).
Commit Message
Since the patch touches a test case in stdlib I'd like to get
at least one OK from the senior maintainers.
Links:
https://sourceware.org/bugzilla/show_bug.cgi?id=24614
https://st.unicode.org/cldr-apps/v#/nl/Number_Formatting_Patterns/
Regards,
Rafal
-- >8 --
According to CLDR 35.1 and the bug report the correct monetary format
for negative amounts should be "EUR -1 234,56" while previously it was
"EUR 1 234,56-".
This patch does not change the thousands (grouping) separator.
[BZ #24614]
* localedata/locales/nl_NL (n_sep_by_space): Set to 2 (a space
between the currency symbol and the minus sign).
(n_sign_posn): Set to 4 (the minus sign after the currency symbol).
* stdlib/Makefile (LOCALES): Append nl_NL.UTF-8.
* stdlib/tst-strfmon_l.c (tests): Add test data for nl_NL.UTF-8.
---
localedata/locales/nl_NL | 4 ++--
stdlib/Makefile | 2 +-
stdlib/tst-strfmon_l.c | 13 +++++++++++++
3 files changed, 16 insertions(+), 3 deletions(-)
Comments
* Rafal Luzynski:
> diff --git a/stdlib/tst-strfmon_l.c b/stdlib/tst-strfmon_l.c
> index a193ed6787..7f0f6d47d5 100644
> --- a/stdlib/tst-strfmon_l.c
> +++ b/stdlib/tst-strfmon_l.c
> @@ -216,6 +216,19 @@ static const struct locale_pair tests[] =
> }
> }
> },
> + {
> + "nl_NL.UTF-8",
> + {
> + {
> + "EUR 1\u202f234\u202f567,89", "\u20ac 1\u202f234\u202f567,89",
> + "EUR 1234567,89", "\u20ac 1234567,89"
> + },
> + {
> + "EUR -1\u202f234\u202f567,89", "\u20ac -1\u202f234\u202f567,89",
> + "EUR -1234567,89", "\u20ac -1234567,89",
> + }
> + }
> + },
> {}
> };
Originally, this test was intended as a test for strfmon_l, in
particular that the locale argument controls all aspects of the
formatting, and not just a subset. It is not a general-purpose locale
test.
For locale testing, we should perhaps iterate through all supported
locales and check against test expectations for number and money
formatting. I don't think we do that today.
Thanks,
Florian
7.06.2019 09:58 Florian Weimer <fweimer@redhat.com> wrote:
>
> * Rafal Luzynski:
>
> > diff --git a/stdlib/tst-strfmon_l.c b/stdlib/tst-strfmon_l.c
> > index a193ed6787..7f0f6d47d5 100644
> > --- a/stdlib/tst-strfmon_l.c
> > +++ b/stdlib/tst-strfmon_l.c
> > @@ -216,6 +216,19 @@ static const struct locale_pair tests[] =
> > [...]
>
> Originally, this test was intended as a test for strfmon_l, in
> particular that the locale argument controls all aspects of the
> formatting, and not just a subset. It is not a general-purpose locale
> test.
Thank you for this feedback, I did not know.
> For locale testing, we should perhaps iterate through all supported
> locales and check against test expectations for number and money
> formatting. I don't think we do that today.
There is another test program: localedata/tst-strfmon1.c. I thought
that those two should be merged but now I guess that you would prefer
to have the test case added to localedata/tst-strfmon1.c instead of
to stdlib/tst-strfmon_l.c.
I don't think we are going to test *all* locales. The collation tests
are huge and cover many locales but definitely not all.
Regards,
Rafal
@@ -83,9 +83,9 @@ frac_digits 2
p_cs_precedes 1
p_sep_by_space 1
n_cs_precedes 1
-n_sep_by_space 1
+n_sep_by_space 2
p_sign_posn 1
-n_sign_posn 2
+n_sign_posn 4
END LC_MONETARY
LC_NUMERIC
@@ -171,7 +171,7 @@ include ../Rules
ifeq ($(run-built-tests),yes)
LOCALES := cs_CZ.UTF-8 de_DE.UTF-8 en_US.ISO-8859-1 tr_TR.UTF-8 \
tr_TR.ISO-8859-9 tg_TJ.UTF-8 hr_HR.UTF-8 hi_IN.UTF-8 \
- el_GR.UTF-8
+ el_GR.UTF-8 nl_NL.UTF-8
include ../gen-locales.mk
$(objpfx)bug-strtod2.out: $(gen-locales)
@@ -216,6 +216,19 @@ static const struct locale_pair tests[] =
}
}
},
+ {
+ "nl_NL.UTF-8",
+ {
+ {
+ "EUR 1\u202f234\u202f567,89", "\u20ac 1\u202f234\u202f567,89",
+ "EUR 1234567,89", "\u20ac 1234567,89"
+ },
+ {
+ "EUR -1\u202f234\u202f567,89", "\u20ac -1\u202f234\u202f567,89",
+ "EUR -1234567,89", "\u20ac -1234567,89",
+ }
+ }
+ },
{}
};