Commit 4393ea5ae8135fa72ddbda1a0124a375c4815065

Bruno Haible 2025-07-15T11:19:10

nstrftime: Add support for non-Gregorian calendars. * lib/calendars.h: New file. * lib/calendar-thai.h: New file. * lib/calendar-persian.h: New file. * lib/calendar-ethiopian.h: New file. * lib/strftime.h (nstrftime): Document which directives don't work with non-Gregorian calendars. * lib/strftime.c (SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME): New macro. Include localcharset.h, localename.h, calendars.h. (CAL_ARGS): New macro. (my_strftime): Recognize locales with non-Gregorian calendars. Pass cal and caldate down to __strftime_internal. (__strftime_internal): Accept additional parameters cal, caldate. Remove rejection of modifier 'O' for directive 'Y' and allow a non-ASCII alternate digits base. Produce calendar-aware output for the directives 'b', 'h', 'B', 'x', 'd', 'e', 'm', 'Y'. * modules/nstrftime (Files): Add the calendar files. (Depends-on): Add localcharset. (Link): New section. * modules/fprintftime (Link): New section. * tests/test-nstrftime-DE.c: New file. * tests/test-nstrftime-TH.c: New file. * tests/test-nstrftime-IR.c: New file. * tests/test-nstrftime-ET.c: New file. * modules/nstrftime-tests (Files): Add them. (Depends-on): Add localcharset, setenv. (Makefile.am): Link test-nstrftime with $(INTL_MACOSX_LIBS). Arrange to compile and run test-nstrftime-DE, test-nstrftime-TH, test-nstrftime-IR, test-nstrftime-ET.