diff options
author | Rafal Luzynski <digitalfreak@lingonborough.com> | 2017-11-14 02:22:38 +0100 |
---|---|---|
committer | Rafal Luzynski <digitalfreak@lingonborough.com> | 2018-01-22 11:26:55 +0100 |
commit | 761a585ce9245d5ad968303b200eef1f26fd501c (patch) | |
tree | eb8b910a79124554a0863d26a4dae85e3cfef4bf /time/tst-strptime.c | |
parent | 95cb863a1ef7760a11272bbd7ba5fe62dc41be54 (diff) | |
download | glibc-761a585ce9245d5ad968303b200eef1f26fd501c.tar.gz glibc-761a585ce9245d5ad968303b200eef1f26fd501c.tar.xz glibc-761a585ce9245d5ad968303b200eef1f26fd501c.zip |
Abbreviated alternative month names (%Ob) also added (bug 10871).
All the previous changes also repeated to support abbreviated alternative month names. In most languages which have declension and need nominative/genitive month names the abbreviated forms for both cases are the same. An example where they do differ is May in Russian: this name is too short to be abbreviated so even the abbreviated form features the declension suffixes. [BZ #10871] * locale/C-time.c (_nl_C_LC_TIME): Add abbreviated alternative month names, define them as the same as abbreviated month names explicitly. * locale/categories.def (LC_TIME): Add ab_alt_mon and wide-ab_alt_mon. * locale/langinfo.h: (_NL_ABALTMON_1, _NL_ABALTMON_2, _NL_ABALTMON_3, _NL_ABALTMON_4, _NL_ABALTMON_5, _NL_ABALTMON_6, _NL_ABALTMON_7, _NL_ABALTMON_8, _NL_ABALTMON_9, _NL_ABALTMON_10, _NL_ABALTMON_11, _NL_ABALTMON_12, _NL_WABALTMON_1, _NL_WABALTMON_2, _NL_WABALTMON_3, _NL_WABALTMON_4, _NL_WABALTMON_5, _NL_WABALTMON_6, _NL_WABALTMON_7, _NL_WABALTMON_8, _NL_WABALTMON_9, _NL_WABALTMON_10, _NL_WABALTMON_11, _NL_WABALTMON_12): New enum constants. * locale/programs/ld-time.c (struct locale_time_t): Add ab_alt_mon, wab_alt_mon, and ab_alt_mon_defined members. (time_output): Output ab_alt_mon and wab_alt_mon members. (time_read): Read them, initialize them as copies of abmon and wabmon respectively if they are missing, initialize ab_alt_mon_defined. * locale/programs/locfile-kw.gperf (ab_alt_mon): Define. * locale/programs/locfile-kw.h: Regenerate. * locale/programs/locfile-token.h (tok_ab_alt_mon): New enum constant. * time/Makefile [$(run-built-tests) = yes] (LOCALES): Add es_ES.UTF-8 and ru_RU.UTF-8. * time/strftime_l.c (a_altmonth, aam_len): New macros. [!COMPILE_WIDE] (ABALTMON_1): New macro. (__strftime_internal): Handle %Ob and %Oh formats. * time/strptime_l.c [_LIBC] (ab_alt_month_name): New macro. (__strptime_internal): Handle %Ob and %Oh formats. * time/tst-strptime.c (day_tests): Add more tests to parse different forms of month names including the new %Ob format specifier. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'time/tst-strptime.c')
-rw-r--r-- | time/tst-strptime.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/time/tst-strptime.c b/time/tst-strptime.c index 62ecb7c804..2eac5a25cb 100644 --- a/time/tst-strptime.c +++ b/time/tst-strptime.c @@ -56,6 +56,7 @@ static const struct { "en_US.ISO-8859-1", "November 17, 2017", "%B %e, %Y", 5, 320, 10, 17 }, { "de_DE.ISO-8859-1", "18. Nov 2017", "%d. %b %Y", 6, 321, 10, 18 }, { "fr_FR.UTF-8", "19 novembre 2017", "%d %OB %Y", 0, 322, 10, 19 }, + { "es_ES.UTF-8", "20 de nov de 2017", "%d de %Ob de %Y", 1, 323, 10, 20 }, /* Some languages do need the declension of the month names. */ { "pl_PL.UTF-8", "21 lis 2017", "%d %b %Y", 2, 324, 10, 21 }, { "pl_PL.UTF-8", "22 LIS 2017", "%d %B %Y", 3, 325, 10, 22 }, @@ -63,6 +64,14 @@ static const struct { "pl_PL.UTF-8", "23 listopad 2017", "%d %B %Y", 4, 326, 10, 23 }, /* The nominative case is incorrect here but it is parseable. */ { "pl_PL.UTF-8", "24 listopad 2017", "%d %OB %Y", 5, 327, 10, 24 }, + { "pl_PL.UTF-8", "25 lis 2017", "%d %Ob %Y", 6, 328, 10, 25 }, + /* ноя - pronounce: 'noya' - "Nov" (abbreviated "November") in Russian. */ + { "ru_RU.UTF-8", "26 ноя 2017", "%d %b %Y", 0, 329, 10, 26 }, + /* TODO: Add an example of "may"/"maya" (5th month, May) using %Ob in + Russian when the localedata is updated. Without the genitive forms + in localedata the word "maya" is ambiguous and may be mistaken for + "mart" (March). + */ }; |