diff mbox

[RFC,v2,1/6] Implement alternative month names (bug 10871).

Message ID 1162527228.420220.60a90901-4334-4cea-aa99-f76884316a10.open-xchange@poczta.nazwa.pl
State New
Headers show

Commit Message

Rafal Luzynski March 25, 2016, 12:52 a.m. UTC
Some languages (Slavic, Baltic, etc.) require a genitive case of the
month name when formatting a full date (with the day number) while
they require a nominative case when referring to the month standalone.
This requirement cannot be fulfilled without providing two forms for
each month name.  This new feature is optional so the languages which
do not need it or do not yet provide the updated locales simply do not
use it and their behaviour is unchanged.

This patch defines the new constants ALTMON_1 .. ALTMON_12 which allow
for defining the alternative month forms where required.

[BZ #10871]
* conform/data/langinfo.h-data: constants ALTMON_1 .. ALTMON_12 added.
* locale/C-time.c: define all alternative month names as empty strings.
* locale/categories.def: alt_mon and wide-alt_mon added.
* locale/langinfo.h: ALTMON_1 .. ALTMON_12 and similar contants defined.
* locale/loadlocale.c: correct size of _nl_value_type_LC_<category> arrays.
* locale/programs/ld-time.c: alternative month names support added.
* locale/programs/locfile-kw.gperf: alt_mon defined.
* locale/programs/locfile-kw.h: regenerated for alt_mon.
* locale/programs/locfile-token.h: alt_mon defined.
---
 conform/data/langinfo.h-data     |  12 +++++
 locale/C-time.c                  |  28 +++++++++-
 locale/categories.def            |   2 +
 locale/langinfo.h                |  52 ++++++++++++++++++-
 locale/loadlocale.c              |   3 +-
 locale/programs/ld-time.c        |  13 +++++
 locale/programs/locfile-kw.gperf |   1 +
 locale/programs/locfile-kw.h     | 108 ++++++++++++++++++++-------------------
 locale/programs/locfile-token.h  |   1 +
 9 files changed, 162 insertions(+), 58 deletions(-)

Comments

Chris Leonard March 25, 2016, 1:54 a.m. UTC | #1
Query:

I'm not especially well versed in which languages have a nom/gen
distinction, but I am aware of languages which have 13 months (because
of lunar calendars).  Is it safer to include an ALTMON_13 just in case
of overlap between the two variants?

cjl

On Thu, Mar 24, 2016 at 8:52 PM, Rafal Luzynski
<digitalfreak@lingonborough.com> wrote:
> Some languages (Slavic, Baltic, etc.) require a genitive case of the
> month name when formatting a full date (with the day number) while
> they require a nominative case when referring to the month standalone.
> This requirement cannot be fulfilled without providing two forms for
> each month name.  This new feature is optional so the languages which
> do not need it or do not yet provide the updated locales simply do not
> use it and their behaviour is unchanged.
>
> This patch defines the new constants ALTMON_1 .. ALTMON_12 which allow
> for defining the alternative month forms where required.
>
> [BZ #10871]
> * conform/data/langinfo.h-data: constants ALTMON_1 .. ALTMON_12 added.
> * locale/C-time.c: define all alternative month names as empty strings.
> * locale/categories.def: alt_mon and wide-alt_mon added.
> * locale/langinfo.h: ALTMON_1 .. ALTMON_12 and similar contants defined.
> * locale/loadlocale.c: correct size of _nl_value_type_LC_<category> arrays.
> * locale/programs/ld-time.c: alternative month names support added.
> * locale/programs/locfile-kw.gperf: alt_mon defined.
> * locale/programs/locfile-kw.h: regenerated for alt_mon.
> * locale/programs/locfile-token.h: alt_mon defined.
> ---
>  conform/data/langinfo.h-data     |  12 +++++
>  locale/C-time.c                  |  28 +++++++++-
>  locale/categories.def            |   2 +
>  locale/langinfo.h                |  52 ++++++++++++++++++-
>  locale/loadlocale.c              |   3 +-
>  locale/programs/ld-time.c        |  13 +++++
>  locale/programs/locfile-kw.gperf |   1 +
>  locale/programs/locfile-kw.h     | 108 ++++++++++++++++++++-------------------
>  locale/programs/locfile-token.h  |   1 +
>  9 files changed, 162 insertions(+), 58 deletions(-)
>
> diff --git a/conform/data/langinfo.h-data b/conform/data/langinfo.h-data
> index 51dd925..4778bc4 100644
> --- a/conform/data/langinfo.h-data
> +++ b/conform/data/langinfo.h-data
> @@ -49,6 +49,18 @@ constant ERA_D_FMT
>  constant ERA_D_T_FMT
>  constant ERA_T_FMT
>  constant ALT_DIGITS
> +constant ALTMON_1
> +constant ALTMON_2
> +constant ALTMON_3
> +constant ALTMON_4
> +constant ALTMON_5
> +constant ALTMON_6
> +constant ALTMON_7
> +constant ALTMON_8
> +constant ALTMON_9
> +constant ALTMON_10
> +constant ALTMON_11
> +constant ALTMON_12
>  constant RADIXCHAR
>  constant THOUSEP
>  constant YESEXPR
> diff --git a/locale/C-time.c b/locale/C-time.c
> index 2f95307..42052f7 100644
> --- a/locale/C-time.c
> +++ b/locale/C-time.c
> @@ -30,7 +30,7 @@ const struct __locale_data _nl_C_LC_TIME attribute_hidden =
>    { NULL, },                   /* no cached data */
>    UNDELETABLE,
>    0,
> -  111,
> +  135,
>    {
>      { .string = "Sun" },
>      { .string = "Mon" },
> @@ -142,6 +142,30 @@ const struct __locale_data _nl_C_LC_TIME attribute_hidden =
>      { .string = "" },
>      { .string = "%a %b %e %H:%M:%S %Z %Y" },
>      { .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
> -    { .string = _nl_C_codeset }
> +    { .string = _nl_C_codeset },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .string = "" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" },
> +    { .wstr = (const uint32_t *) L"" }
>    }
>  };
> diff --git a/locale/categories.def b/locale/categories.def
> index d8a3ab8..1655901 100644
> --- a/locale/categories.def
> +++ b/locale/categories.def
> @@ -249,6 +249,8 @@ DEFINE_CATEGORY
>    DEFINE_ELEMENT (_DATE_FMT,                "date_fmt",            opt, string)
>    DEFINE_ELEMENT (_NL_W_DATE_FMT,           "wide-date_fmt",       opt,
> wstring)
>    DEFINE_ELEMENT (_NL_TIME_CODESET,        "time-codeset",        std, string)
> +  DEFINE_ELEMENT (ALTMON_1,       "alt_mon",       opt, stringarray, 12, 12)
> +  DEFINE_ELEMENT (_NL_WALTMON_1,  "wide-alt_mon",    opt, wstringarray, 12, 12)
>    ), NO_POSTLOAD)
>
>
> diff --git a/locale/langinfo.h b/locale/langinfo.h
> index 481e226..1b946ae 100644
> --- a/locale/langinfo.h
> +++ b/locale/langinfo.h
> @@ -101,7 +101,9 @@ enum
>  #define ABMON_12               ABMON_12
>
>    /* Long month names.  */
> -  MON_1,                       /* January */
> +  /* For languages which need both a nominative and a genitive case,
> +     this is the genitive.  */
> +  MON_1,                       /* January (or "of January") */
>  #define MON_1                  MON_1
>    MON_2,
>  #define MON_2                  MON_2
> @@ -190,7 +192,9 @@ enum
>    _NL_WABMON_12,
>
>    /* Long month names.  */
> -  _NL_WMON_1,          /* January */
> +  /* For languages which need both a nominative and a genitive case,
> +     this is the genitive.  */
> +  _NL_WMON_1,          /* January (or "of January") */
>    _NL_WMON_2,
>    _NL_WMON_3,
>    _NL_WMON_4,
> @@ -231,6 +235,50 @@ enum
>
>    _NL_TIME_CODESET,
>
> +  /* Alternative (nominative, standalone only) month names.  */
> +  /* Languages which do not need nominative and genitive month names
> +     can ignore this feature.  */
> +  ALTMON_1,                    /* January */
> +#define ALTMON_1               ALTMON_1
> +  ALTMON_2,
> +#define ALTMON_2               ALTMON_2
> +  ALTMON_3,
> +#define ALTMON_3               ALTMON_3
> +  ALTMON_4,
> +#define ALTMON_4               ALTMON_4
> +  ALTMON_5,
> +#define ALTMON_5               ALTMON_5
> +  ALTMON_6,
> +#define ALTMON_6               ALTMON_6
> +  ALTMON_7,
> +#define ALTMON_7               ALTMON_7
> +  ALTMON_8,
> +#define ALTMON_8               ALTMON_8
> +  ALTMON_9,
> +#define ALTMON_9               ALTMON_9
> +  ALTMON_10,
> +#define ALTMON_10              ALTMON_10
> +  ALTMON_11,
> +#define ALTMON_11              ALTMON_11
> +  ALTMON_12,
> +#define ALTMON_12              ALTMON_12
> +
> +  /* Alternative (nominative, standalone only) month names.  */
> +  /* Languages which do not need nominative and genitive month names
> +     can ignore this feature.  */
> +  _NL_WALTMON_1,                       /* January */
> +  _NL_WALTMON_2,
> +  _NL_WALTMON_3,
> +  _NL_WALTMON_4,
> +  _NL_WALTMON_5,
> +  _NL_WALTMON_6,
> +  _NL_WALTMON_7,
> +  _NL_WALTMON_8,
> +  _NL_WALTMON_9,
> +  _NL_WALTMON_10,
> +  _NL_WALTMON_11,
> +  _NL_WALTMON_12,
> +
>    _NL_NUM_LC_TIME,     /* Number of indices in LC_TIME category.  */
>
>    /* LC_COLLATE category: text sorting.
> diff --git a/locale/loadlocale.c b/locale/loadlocale.c
> index 2b589ee..2f2025c 100644
> --- a/locale/loadlocale.c
> +++ b/locale/loadlocale.c
> @@ -45,7 +45,8 @@ static const size_t _nl_category_num_items[] =
>  #define NO_PAREN(arg, rest...) arg, ##rest
>
>  #define DEFINE_CATEGORY(category, category_name, items, a) \
> -static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
> +static const enum value_type _nl_value_type_##category     \
> +  [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items };
>  #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
>    [_NL_ITEM_INDEX (element)] = type,
>  #include "categories.def"
> diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
> index ca31c9c..d7871ab 100644
> --- a/locale/programs/ld-time.c
> +++ b/locale/programs/ld-time.c
> @@ -91,6 +91,9 @@ struct locale_time_t
>    const char *date_fmt;
>    const uint32_t *wdate_fmt;
>    int alt_digits_defined;
> +  const char *alt_mon[12];
> +  const uint32_t *walt_mon[12];
> +  int alt_mon_defined;
>    unsigned char week_ndays;
>    uint32_t week_1stday;
>    unsigned char week_1stweek;
> @@ -648,6 +651,15 @@ time_output (struct localedef_t *locale, const struct
> charmap_t *charmap,
>    add_locale_string (&file, time->date_fmt);
>    add_locale_wstring (&file, time->wdate_fmt);
>    add_locale_string (&file, charmap->code_set_name);
> +
> +  /* The alt'mons.  */
> +  for (n = 0; n < 12; ++n)
> +    add_locale_string (&file, time->alt_mon[n] ?: "");
> +
> +  /* The wide character alt'mons.  */
> +  for (n = 0; n < 12; ++n)
> +    add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
> +
>    write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
>  }
>
> @@ -791,6 +803,7 @@ time_read (struct linereader *ldfile, struct localedef_t
> *result,
>           STRARR_ELEM (mon, 12, 12);
>           STRARR_ELEM (am_pm, 2, 2);
>           STRARR_ELEM (alt_digits, 0, 100);
> +         STRARR_ELEM (alt_mon, 12, 12);
>
>         case tok_era:
>           /* Ignore the rest of the line if we don't need the input of
> diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf
> index 5fea696..bf533a1 100644
> --- a/locale/programs/locfile-kw.gperf
> +++ b/locale/programs/locfile-kw.gperf
> @@ -148,6 +148,7 @@ first_workday,          tok_first_workday,          0
>  cal_direction,          tok_cal_direction,          0
>  timezone,               tok_timezone,               0
>  date_fmt,               tok_date_fmt,               0
> +alt_mon,                tok_alt_mon,                0
>  LC_MESSAGES,            tok_lc_messages,            0
>  yesexpr,                tok_yesexpr,                0
>  noexpr,                 tok_noexpr,                 0
> diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h
> index 16b87d4..7a87093 100644
> --- a/locale/programs/locfile-kw.h
> +++ b/locale/programs/locfile-kw.h
> @@ -54,7 +54,7 @@
>  #line 24 "locfile-kw.gperf"
>  struct keyword_t ;
>
> -#define TOTAL_KEYWORDS 176
> +#define TOTAL_KEYWORDS 177
>  #define MIN_WORD_LENGTH 3
>  #define MAX_WORD_LENGTH 22
>  #define MIN_HASH_VALUE 3
> @@ -147,22 +147,22 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 30 "locfile-kw.gperf"
>        {"LC_CTYPE",               tok_lc_ctype,               0},
>        {""},
> -#line 166 "locfile-kw.gperf"
> +#line 167 "locfile-kw.gperf"
>        {"LC_ADDRESS",             tok_lc_address,             0},
> -#line 151 "locfile-kw.gperf"
> +#line 152 "locfile-kw.gperf"
>        {"LC_MESSAGES",            tok_lc_messages,            0},
> -#line 159 "locfile-kw.gperf"
> +#line 160 "locfile-kw.gperf"
>        {"LC_NAME",                tok_lc_name,                0},
> -#line 156 "locfile-kw.gperf"
> +#line 157 "locfile-kw.gperf"
>        {"LC_PAPER",               tok_lc_paper,               0},
> -#line 184 "locfile-kw.gperf"
> +#line 185 "locfile-kw.gperf"
>        {"LC_MEASUREMENT",         tok_lc_measurement,         0},
>  #line 56 "locfile-kw.gperf"
>        {"LC_COLLATE",             tok_lc_collate,             0},
>        {""},
> -#line 186 "locfile-kw.gperf"
> +#line 187 "locfile-kw.gperf"
>        {"LC_IDENTIFICATION",      tok_lc_identification,      0},
> -#line 199 "locfile-kw.gperf"
> +#line 200 "locfile-kw.gperf"
>        {"revision",               tok_revision,               0},
>  #line 69 "locfile-kw.gperf"
>        {"UNDEFINED",              tok_undefined,              0},
> @@ -170,19 +170,19 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {"LC_NUMERIC",             tok_lc_numeric,             0},
>  #line 82 "locfile-kw.gperf"
>        {"LC_MONETARY",            tok_lc_monetary,            0},
> -#line 179 "locfile-kw.gperf"
> +#line 180 "locfile-kw.gperf"
>        {"LC_TELEPHONE",           tok_lc_telephone,           0},
>        {""}, {""}, {""},
>  #line 75 "locfile-kw.gperf"
>        {"define",                 tok_define,                 0},
> -#line 152 "locfile-kw.gperf"
> +#line 153 "locfile-kw.gperf"
>        {"yesexpr",                tok_yesexpr,                0},
>  #line 141 "locfile-kw.gperf"
>        {"era_year",               tok_era_year,               0},
>        {""},
>  #line 54 "locfile-kw.gperf"
>        {"translit_ignore",        tok_translit_ignore,        0},
> -#line 154 "locfile-kw.gperf"
> +#line 155 "locfile-kw.gperf"
>        {"yesstr",                 tok_yesstr,                 0},
>        {""},
>  #line 89 "locfile-kw.gperf"
> @@ -190,7 +190,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""},
>  #line 137 "locfile-kw.gperf"
>        {"t_fmt",                  tok_t_fmt,                  0},
> -#line 157 "locfile-kw.gperf"
> +#line 158 "locfile-kw.gperf"
>        {"height",                 tok_height,                 0},
>        {""}, {""},
>  #line 52 "locfile-kw.gperf"
> @@ -213,7 +213,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""},
>  #line 142 "locfile-kw.gperf"
>        {"era_d_fmt",              tok_era_d_fmt,              0},
> -#line 187 "locfile-kw.gperf"
> +#line 188 "locfile-kw.gperf"
>        {"title",                  tok_title,                  0},
>        {""}, {""},
>  #line 149 "locfile-kw.gperf"
> @@ -243,7 +243,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {"duo_n_cs_precedes",      tok_duo_n_cs_precedes,      0},
>  #line 127 "locfile-kw.gperf"
>        {"thousands_sep",          tok_thousands_sep,          0},
> -#line 195 "locfile-kw.gperf"
> +#line 196 "locfile-kw.gperf"
>        {"territory",              tok_territory,              0},
>  #line 36 "locfile-kw.gperf"
>        {"digit",                  tok_digit,                  0},
> @@ -258,7 +258,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""},
>  #line 78 "locfile-kw.gperf"
>        {"else",                   tok_else,                   0},
> -#line 182 "locfile-kw.gperf"
> +#line 183 "locfile-kw.gperf"
>        {"int_select",             tok_int_select,             0},
>        {""}, {""}, {""},
>  #line 132 "locfile-kw.gperf"
> @@ -266,11 +266,11 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 33 "locfile-kw.gperf"
>        {"upper",                  tok_upper,                  0},
>        {""}, {""},
> -#line 192 "locfile-kw.gperf"
> +#line 193 "locfile-kw.gperf"
>        {"tel",                    tok_tel,                    0},
>  #line 93 "locfile-kw.gperf"
>        {"p_sep_by_space",         tok_p_sep_by_space,         0},
> -#line 158 "locfile-kw.gperf"
> +#line 159 "locfile-kw.gperf"
>        {"width",                  tok_width,                  0},
>        {""},
>  #line 98 "locfile-kw.gperf"
> @@ -301,7 +301,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""}, {""}, {""}, {""}, {""},
>  #line 58 "locfile-kw.gperf"
>        {"section-symbol",         tok_section_symbol,         0},
> -#line 183 "locfile-kw.gperf"
> +#line 184 "locfile-kw.gperf"
>        {"int_prefix",             tok_int_prefix,             0},
>        {""}, {""}, {""}, {""},
>  #line 42 "locfile-kw.gperf"
> @@ -318,7 +318,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {"duo_p_sep_by_space",     tok_duo_p_sep_by_space,     0},
>  #line 118 "locfile-kw.gperf"
>        {"duo_int_p_sign_posn",    tok_duo_int_p_sign_posn,    0},
> -#line 155 "locfile-kw.gperf"
> +#line 156 "locfile-kw.gperf"
>        {"nostr",                  tok_nostr,                  0},
>        {""}, {""},
>  #line 140 "locfile-kw.gperf"
> @@ -327,26 +327,26 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 84 "locfile-kw.gperf"
>        {"currency_symbol",        tok_currency_symbol,        0},
>        {""},
> -#line 165 "locfile-kw.gperf"
> +#line 166 "locfile-kw.gperf"
>        {"name_ms",                tok_name_ms,                0},
> -#line 163 "locfile-kw.gperf"
> -      {"name_mrs",               tok_name_mrs,               0},
>  #line 164 "locfile-kw.gperf"
> +      {"name_mrs",               tok_name_mrs,               0},
> +#line 165 "locfile-kw.gperf"
>        {"name_miss",              tok_name_miss,              0},
>  #line 83 "locfile-kw.gperf"
>        {"int_curr_symbol",        tok_int_curr_symbol,        0},
> -#line 188 "locfile-kw.gperf"
> +#line 189 "locfile-kw.gperf"
>        {"source",                 tok_source,                 0},
> -#line 162 "locfile-kw.gperf"
> +#line 163 "locfile-kw.gperf"
>        {"name_mr",                tok_name_mr,                0},
> -#line 161 "locfile-kw.gperf"
> +#line 162 "locfile-kw.gperf"
>        {"name_gen",               tok_name_gen,               0},
> -#line 200 "locfile-kw.gperf"
> +#line 201 "locfile-kw.gperf"
>        {"date",                   tok_date,                   0},
>        {""}, {""},
> -#line 189 "locfile-kw.gperf"
> +#line 190 "locfile-kw.gperf"
>        {"address",                tok_address,                0},
> -#line 160 "locfile-kw.gperf"
> +#line 161 "locfile-kw.gperf"
>        {"name_fmt",               tok_name_fmt,               0},
>  #line 32 "locfile-kw.gperf"
>        {"copy",                   tok_copy,                   0},
> @@ -365,16 +365,16 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 117 "locfile-kw.gperf"
>        {"duo_n_sign_posn",        tok_duo_n_sign_posn,        0},
>        {""},
> -#line 168 "locfile-kw.gperf"
> +#line 169 "locfile-kw.gperf"
>        {"country_name",           tok_country_name,           0},
>  #line 71 "locfile-kw.gperf"
>        {"reorder-after",          tok_reorder_after,          0},
>        {""}, {""},
> -#line 153 "locfile-kw.gperf"
> +#line 154 "locfile-kw.gperf"
>        {"noexpr",                 tok_noexpr,                 0},
>  #line 50 "locfile-kw.gperf"
>        {"tolower",                tok_tolower,                0},
> -#line 196 "locfile-kw.gperf"
> +#line 197 "locfile-kw.gperf"
>        {"audience",               tok_audience,               0},
>        {""}, {""}, {""},
>  #line 49 "locfile-kw.gperf"
> @@ -395,7 +395,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""},
>  #line 102 "locfile-kw.gperf"
>        {"int_p_sign_posn",        tok_int_p_sign_posn,        0},
> -#line 173 "locfile-kw.gperf"
> +#line 174 "locfile-kw.gperf"
>        {"country_car",            tok_country_car,            0},
>        {""}, {""},
>  #line 104 "locfile-kw.gperf"
> @@ -406,9 +406,9 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""}, {""},
>  #line 116 "locfile-kw.gperf"
>        {"duo_p_sign_posn",        tok_duo_p_sign_posn,        0},
> -#line 185 "locfile-kw.gperf"
> +#line 186 "locfile-kw.gperf"
>        {"measurement",            tok_measurement,            0},
> -#line 174 "locfile-kw.gperf"
> +#line 175 "locfile-kw.gperf"
>        {"country_isbn",           tok_country_isbn,           0},
>  #line 37 "locfile-kw.gperf"
>        {"outdigit",               tok_outdigit,               0},
> @@ -418,9 +418,9 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""}, {""}, {""},
>  #line 34 "locfile-kw.gperf"
>        {"lower",                  tok_lower,                  0},
> -#line 181 "locfile-kw.gperf"
> +#line 182 "locfile-kw.gperf"
>        {"tel_dom_fmt",            tok_tel_dom_fmt,            0},
> -#line 169 "locfile-kw.gperf"
> +#line 170 "locfile-kw.gperf"
>        {"country_post",           tok_country_post,           0},
>  #line 148 "locfile-kw.gperf"
>        {"cal_direction",          tok_cal_direction,          0},
> @@ -430,7 +430,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 91 "locfile-kw.gperf"
>        {"frac_digits",            tok_frac_digits,            0},
>        {""}, {""},
> -#line 175 "locfile-kw.gperf"
> +#line 176 "locfile-kw.gperf"
>        {"lang_name",              tok_lang_name,              0},
>  #line 90 "locfile-kw.gperf"
>        {"int_frac_digits",        tok_int_frac_digits,        0},
> @@ -445,7 +445,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {""}, {""}, {""}, {""},
>  #line 107 "locfile-kw.gperf"
>        {"duo_frac_digits",        tok_duo_frac_digits,        0},
> -#line 180 "locfile-kw.gperf"
> +#line 181 "locfile-kw.gperf"
>        {"tel_int_fmt",            tok_tel_int_fmt,            0},
>  #line 123 "locfile-kw.gperf"
>        {"duo_valid_to",           tok_duo_valid_to,           0},
> @@ -455,7 +455,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 130 "locfile-kw.gperf"
>        {"abday",                  tok_abday,                  0},
>        {""},
> -#line 198 "locfile-kw.gperf"
> +#line 199 "locfile-kw.gperf"
>        {"abbreviation",           tok_abbreviation,           0},
>  #line 147 "locfile-kw.gperf"
>        {"first_workday",          tok_first_workday,          0},
> @@ -472,12 +472,12 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 45 "locfile-kw.gperf"
>        {"blank",                  tok_blank,                  0},
>        {""}, {""},
> -#line 194 "locfile-kw.gperf"
> +#line 195 "locfile-kw.gperf"
>        {"language",               tok_language,               0},
>  #line 120 "locfile-kw.gperf"
>        {"uno_valid_from",         tok_uno_valid_from,         0},
>        {""},
> -#line 197 "locfile-kw.gperf"
> +#line 198 "locfile-kw.gperf"
>        {"application",            tok_application,            0},
>        {""},
>  #line 80 "locfile-kw.gperf"
> @@ -498,7 +498,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 96 "locfile-kw.gperf"
>        {"p_sign_posn",            tok_p_sign_posn,            0},
>        {""},
> -#line 201 "locfile-kw.gperf"
> +#line 202 "locfile-kw.gperf"
>        {"category",               tok_category,               0},
>        {""}, {""}, {""}, {""},
>  #line 134 "locfile-kw.gperf"
> @@ -510,29 +510,29 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 63 "locfile-kw.gperf"
>        {"order_start",            tok_order_start,            0},
>        {""}, {""}, {""}, {""}, {""},
> -#line 176 "locfile-kw.gperf"
> +#line 177 "locfile-kw.gperf"
>        {"lang_ab",                tok_lang_ab,                0},
> -#line 178 "locfile-kw.gperf"
> +#line 179 "locfile-kw.gperf"
>        {"lang_lib",               tok_lang_lib,               0},
>        {""}, {""}, {""},
> -#line 190 "locfile-kw.gperf"
> +#line 191 "locfile-kw.gperf"
>        {"contact",                tok_contact,                0},
>        {""}, {""}, {""},
> -#line 171 "locfile-kw.gperf"
> +#line 172 "locfile-kw.gperf"
>        {"country_ab3",            tok_country_ab3,            0},
>        {""}, {""}, {""},
> -#line 191 "locfile-kw.gperf"
> +#line 192 "locfile-kw.gperf"
>        {"email",                  tok_email,                  0},
> -#line 170 "locfile-kw.gperf"
> +#line 171 "locfile-kw.gperf"
>        {"country_ab2",            tok_country_ab2,            0},
>        {""}, {""}, {""},
>  #line 55 "locfile-kw.gperf"
>        {"default_missing",        tok_default_missing,        0},
>        {""}, {""},
> -#line 193 "locfile-kw.gperf"
> +#line 194 "locfile-kw.gperf"
>        {"fax",                    tok_fax,                    0},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""},
> -#line 172 "locfile-kw.gperf"
> +#line 173 "locfile-kw.gperf"
>        {"country_num",            tok_country_num,            0},
>        {""}, {""}, {""}, {""}, {""}, {""},
>  #line 51 "locfile-kw.gperf"
> @@ -548,7 +548,9 @@ locfile_hash (register const char *str, register unsigned
> int len)
>        {"endif",                  tok_endif,                  0},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
> -      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
> +      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
> +#line 151 "locfile-kw.gperf"
> +      {"alt_mon",                tok_alt_mon,                0},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""},
>  #line 76 "locfile-kw.gperf"
>        {"undef",                  tok_undef,                  0},
> @@ -569,7 +571,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 85 "locfile-kw.gperf"
>        {"mon_decimal_point",      tok_mon_decimal_point,      0},
>        {""}, {""},
> -#line 167 "locfile-kw.gperf"
> +#line 168 "locfile-kw.gperf"
>        {"postal_fmt",             tok_postal_fmt,             0},
>        {""}, {""}, {""}, {""}, {""},
>  #line 60 "locfile-kw.gperf"
> @@ -588,7 +590,7 @@ locfile_hash (register const char *str, register unsigned
> int len)
>  #line 87 "locfile-kw.gperf"
>        {"mon_grouping",           tok_mon_grouping,           0},
>        {""},
> -#line 177 "locfile-kw.gperf"
> +#line 178 "locfile-kw.gperf"
>        {"lang_term",              tok_lang_term,              0},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
>        {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
> diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h
> index d6e7a8b..1a0afb2 100644
> --- a/locale/programs/locfile-token.h
> +++ b/locale/programs/locfile-token.h
> @@ -186,6 +186,7 @@ enum token_t
>    tok_cal_direction,
>    tok_timezone,
>    tok_date_fmt,
> +  tok_alt_mon,
>    tok_lc_messages,
>    tok_yesexpr,
>    tok_noexpr,
> --
> 2.5.0
Rafal Luzynski March 25, 2016, 8:55 p.m. UTC | #2
> 25.03.2016 02:54 Chris Leonard <cjlhomeaddress@gmail.com> wrote:
>
>
> Query:
>
> I'm not especially well versed in which languages have a nom/gen
> distinction, but I am aware of languages which have 13 months (because
> of lunar calendars). Is it safer to include an ALTMON_13 just in case
> of overlap between the two variants?

Sounds like a separate problem but my short answer is: it does not make
sense IMHO.

Indeed it's safer to add ALTMON_13 now than adding it later. But it won't
help you if you don't add MON_13 and ABMON_13. Adding such feature would
be even more horrible task than adding alternative (nominative/genitive)
month names. All nl_langinfo() constants are defined continuously, there
are no gaps between them. If you add MON_13 immediately after MON_12
you will increment the values of all constants after it and you will
break API. Also there are many places in glibc code which assume that
month numbers are 0..11 (12 values) and report an error if they are
outside this range. There is no way to configure the number of months
at the moment. You can add MON_13, ABMON_13 and ALTMON_13 at the end
of the LC_TIME category but then there are places which assume that
all month names make a continuous table and it's correct to refer to
them with a simple expression like month_name[tm_mon]. All those parts
would have to be rewritten.

Does glibc have any support for the lunar calendars? Looks like
it does not at all. Although probably it would be good idea for those
countries/locales which use such calendars.

Best regards,

Rafal
Chris Leonard March 26, 2016, 12:57 a.m. UTC | #3
On Fri, Mar 25, 2016 at 4:55 PM, Rafal Luzynski
<digitalfreak@lingonborough.com> wrote:
>> 25.03.2016 02:54 Chris Leonard <cjlhomeaddress@gmail.com> wrote:

> Does glibc have any support for the lunar calendars? Looks like
> it does not at all. Although probably it would be good idea for those
> countries/locales which use such calendars.


I have to admit I have never looked into it at the code level.  I am
probably mistaken in making an assumption of such support from reading
the "mon" description in TR 14652.

TR 14652
http://www.open-std.org/JTC1/SC22/WG20/docs/n972-14652ft.pdf

states:

mon

Define the full month names, to be referenced by the %B field
descriptor. The operand consists of twelve or thirteen semicolon-
separated strings. The first string is the full name of the first month
of the year (January), the second the full name of the second month,
and so on.

I have not had occasion to create a locale with 13 months (yet), but I
had thought it would be supported, my bad.

cjl
Rafal Luzynski March 29, 2016, 11:15 p.m. UTC | #4
26.03.2016 01:57 Chris Leonard <cjlhomeaddress@gmail.com> wrote:
> [...]
> I have to admit I have never looked into it at the code level. I am
> probably mistaken in making an assumption of such support from reading
> the "mon" description in TR 14652.
>
> TR 14652
> http://www.open-std.org/JTC1/SC22/WG20/docs/n972-14652ft.pdf
>
> states:
>
> mon
>
> Define the full month names, to be referenced by the %B field
> descriptor. The operand consists of twelve or thirteen semicolon-
> separated strings. The first string is the full name of the first month
> of the year (January), the second the full name of the second month,
> and so on.

It looks like glibc does not fully implement the specification from this
document. Feel free to file another bug report related with this.

Best regards,

Rafal
diff mbox

Patch

diff --git a/conform/data/langinfo.h-data b/conform/data/langinfo.h-data
index 51dd925..4778bc4 100644
--- a/conform/data/langinfo.h-data
+++ b/conform/data/langinfo.h-data
@@ -49,6 +49,18 @@  constant ERA_D_FMT
 constant ERA_D_T_FMT
 constant ERA_T_FMT
 constant ALT_DIGITS
+constant ALTMON_1
+constant ALTMON_2
+constant ALTMON_3
+constant ALTMON_4
+constant ALTMON_5
+constant ALTMON_6
+constant ALTMON_7
+constant ALTMON_8
+constant ALTMON_9
+constant ALTMON_10
+constant ALTMON_11
+constant ALTMON_12
 constant RADIXCHAR
 constant THOUSEP
 constant YESEXPR
diff --git a/locale/C-time.c b/locale/C-time.c
index 2f95307..42052f7 100644
--- a/locale/C-time.c
+++ b/locale/C-time.c
@@ -30,7 +30,7 @@  const struct __locale_data _nl_C_LC_TIME attribute_hidden =
   { NULL, },			/* no cached data */
   UNDELETABLE,
   0,
-  111,
+  135,
   {
     { .string = "Sun" },
     { .string = "Mon" },
@@ -142,6 +142,30 @@  const struct __locale_data _nl_C_LC_TIME attribute_hidden =
     { .string = "" },
     { .string = "%a %b %e %H:%M:%S %Z %Y" },
     { .wstr = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y" },
-    { .string = _nl_C_codeset }
+    { .string = _nl_C_codeset },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .string = "" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" },
+    { .wstr = (const uint32_t *) L"" }
   }
 };
diff --git a/locale/categories.def b/locale/categories.def
index d8a3ab8..1655901 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -249,6 +249,8 @@  DEFINE_CATEGORY
   DEFINE_ELEMENT (_DATE_FMT,                "date_fmt",            opt, string)
   DEFINE_ELEMENT (_NL_W_DATE_FMT,           "wide-date_fmt",       opt,
wstring)
   DEFINE_ELEMENT (_NL_TIME_CODESET,	    "time-codeset",	   std, string)
+  DEFINE_ELEMENT (ALTMON_1,       "alt_mon",       opt, stringarray, 12, 12)
+  DEFINE_ELEMENT (_NL_WALTMON_1,  "wide-alt_mon",    opt, wstringarray, 12, 12)
   ), NO_POSTLOAD)
 
 
diff --git a/locale/langinfo.h b/locale/langinfo.h
index 481e226..1b946ae 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -101,7 +101,9 @@  enum
 #define ABMON_12		ABMON_12
 
   /* Long month names.  */
-  MON_1,			/* January */
+  /* For languages which need both a nominative and a genitive case,
+     this is the genitive.  */
+  MON_1,			/* January (or "of January") */
 #define MON_1			MON_1
   MON_2,
 #define MON_2			MON_2
@@ -190,7 +192,9 @@  enum
   _NL_WABMON_12,
 
   /* Long month names.  */
-  _NL_WMON_1,		/* January */
+  /* For languages which need both a nominative and a genitive case,
+     this is the genitive.  */
+  _NL_WMON_1,		/* January (or "of January") */
   _NL_WMON_2,
   _NL_WMON_3,
   _NL_WMON_4,
@@ -231,6 +235,50 @@  enum
 
   _NL_TIME_CODESET,
 
+  /* Alternative (nominative, standalone only) month names.  */
+  /* Languages which do not need nominative and genitive month names
+     can ignore this feature.  */
+  ALTMON_1,			/* January */
+#define ALTMON_1		ALTMON_1
+  ALTMON_2,
+#define ALTMON_2		ALTMON_2
+  ALTMON_3,
+#define ALTMON_3		ALTMON_3
+  ALTMON_4,
+#define ALTMON_4		ALTMON_4
+  ALTMON_5,
+#define ALTMON_5		ALTMON_5
+  ALTMON_6,
+#define ALTMON_6		ALTMON_6
+  ALTMON_7,
+#define ALTMON_7		ALTMON_7
+  ALTMON_8,
+#define ALTMON_8		ALTMON_8
+  ALTMON_9,
+#define ALTMON_9		ALTMON_9
+  ALTMON_10,
+#define ALTMON_10		ALTMON_10
+  ALTMON_11,
+#define ALTMON_11		ALTMON_11
+  ALTMON_12,
+#define ALTMON_12		ALTMON_12
+
+  /* Alternative (nominative, standalone only) month names.  */
+  /* Languages which do not need nominative and genitive month names
+     can ignore this feature.  */
+  _NL_WALTMON_1,			/* January */
+  _NL_WALTMON_2,
+  _NL_WALTMON_3,
+  _NL_WALTMON_4,
+  _NL_WALTMON_5,
+  _NL_WALTMON_6,
+  _NL_WALTMON_7,
+  _NL_WALTMON_8,
+  _NL_WALTMON_9,
+  _NL_WALTMON_10,
+  _NL_WALTMON_11,
+  _NL_WALTMON_12,
+
   _NL_NUM_LC_TIME,	/* Number of indices in LC_TIME category.  */
 
   /* LC_COLLATE category: text sorting.
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 2b589ee..2f2025c 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -45,7 +45,8 @@  static const size_t _nl_category_num_items[] =
 #define NO_PAREN(arg, rest...) arg, ##rest
 
 #define DEFINE_CATEGORY(category, category_name, items, a) \
-static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
+static const enum value_type _nl_value_type_##category     \
+  [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items };
 #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
   [_NL_ITEM_INDEX (element)] = type,
 #include "categories.def"
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index ca31c9c..d7871ab 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -91,6 +91,9 @@  struct locale_time_t
   const char *date_fmt;
   const uint32_t *wdate_fmt;
   int alt_digits_defined;
+  const char *alt_mon[12];
+  const uint32_t *walt_mon[12];
+  int alt_mon_defined;
   unsigned char week_ndays;
   uint32_t week_1stday;
   unsigned char week_1stweek;
@@ -648,6 +651,15 @@  time_output (struct localedef_t *locale, const struct
charmap_t *charmap,
   add_locale_string (&file, time->date_fmt);
   add_locale_wstring (&file, time->wdate_fmt);
   add_locale_string (&file, charmap->code_set_name);
+
+  /* The alt'mons.  */
+  for (n = 0; n < 12; ++n)
+    add_locale_string (&file, time->alt_mon[n] ?: "");
+
+  /* The wide character alt'mons.  */
+  for (n = 0; n < 12; ++n)
+    add_locale_wstring (&file, time->walt_mon[n] ?: empty_wstr);
+
   write_locale_data (output_path, LC_TIME, "LC_TIME", &file);
 }
 
@@ -791,6 +803,7 @@  time_read (struct linereader *ldfile, struct localedef_t
*result,
 	  STRARR_ELEM (mon, 12, 12);
 	  STRARR_ELEM (am_pm, 2, 2);
 	  STRARR_ELEM (alt_digits, 0, 100);
+	  STRARR_ELEM (alt_mon, 12, 12);
 
 	case tok_era:
 	  /* Ignore the rest of the line if we don't need the input of
diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf
index 5fea696..bf533a1 100644
--- a/locale/programs/locfile-kw.gperf
+++ b/locale/programs/locfile-kw.gperf
@@ -148,6 +148,7 @@  first_workday,          tok_first_workday,          0
 cal_direction,          tok_cal_direction,          0
 timezone,               tok_timezone,               0
 date_fmt,               tok_date_fmt,               0
+alt_mon,                tok_alt_mon,                0
 LC_MESSAGES,            tok_lc_messages,            0
 yesexpr,                tok_yesexpr,                0
 noexpr,                 tok_noexpr,                 0
diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h
index 16b87d4..7a87093 100644
--- a/locale/programs/locfile-kw.h
+++ b/locale/programs/locfile-kw.h
@@ -54,7 +54,7 @@ 
 #line 24 "locfile-kw.gperf"
 struct keyword_t ;
 
-#define TOTAL_KEYWORDS 176
+#define TOTAL_KEYWORDS 177
 #define MIN_WORD_LENGTH 3
 #define MAX_WORD_LENGTH 22
 #define MIN_HASH_VALUE 3
@@ -147,22 +147,22 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 30 "locfile-kw.gperf"
       {"LC_CTYPE",               tok_lc_ctype,               0},
       {""},
-#line 166 "locfile-kw.gperf"
+#line 167 "locfile-kw.gperf"
       {"LC_ADDRESS",             tok_lc_address,             0},
-#line 151 "locfile-kw.gperf"
+#line 152 "locfile-kw.gperf"
       {"LC_MESSAGES",            tok_lc_messages,            0},
-#line 159 "locfile-kw.gperf"
+#line 160 "locfile-kw.gperf"
       {"LC_NAME",                tok_lc_name,                0},
-#line 156 "locfile-kw.gperf"
+#line 157 "locfile-kw.gperf"
       {"LC_PAPER",               tok_lc_paper,               0},
-#line 184 "locfile-kw.gperf"
+#line 185 "locfile-kw.gperf"
       {"LC_MEASUREMENT",         tok_lc_measurement,         0},
 #line 56 "locfile-kw.gperf"
       {"LC_COLLATE",             tok_lc_collate,             0},
       {""},
-#line 186 "locfile-kw.gperf"
+#line 187 "locfile-kw.gperf"
       {"LC_IDENTIFICATION",      tok_lc_identification,      0},
-#line 199 "locfile-kw.gperf"
+#line 200 "locfile-kw.gperf"
       {"revision",               tok_revision,               0},
 #line 69 "locfile-kw.gperf"
       {"UNDEFINED",              tok_undefined,              0},
@@ -170,19 +170,19 @@  locfile_hash (register const char *str, register unsigned
int len)
       {"LC_NUMERIC",             tok_lc_numeric,             0},
 #line 82 "locfile-kw.gperf"
       {"LC_MONETARY",            tok_lc_monetary,            0},
-#line 179 "locfile-kw.gperf"
+#line 180 "locfile-kw.gperf"
       {"LC_TELEPHONE",           tok_lc_telephone,           0},
       {""}, {""}, {""},
 #line 75 "locfile-kw.gperf"
       {"define",                 tok_define,                 0},
-#line 152 "locfile-kw.gperf"
+#line 153 "locfile-kw.gperf"
       {"yesexpr",                tok_yesexpr,                0},
 #line 141 "locfile-kw.gperf"
       {"era_year",               tok_era_year,               0},
       {""},
 #line 54 "locfile-kw.gperf"
       {"translit_ignore",        tok_translit_ignore,        0},
-#line 154 "locfile-kw.gperf"
+#line 155 "locfile-kw.gperf"
       {"yesstr",                 tok_yesstr,                 0},
       {""},
 #line 89 "locfile-kw.gperf"
@@ -190,7 +190,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""},
 #line 137 "locfile-kw.gperf"
       {"t_fmt",                  tok_t_fmt,                  0},
-#line 157 "locfile-kw.gperf"
+#line 158 "locfile-kw.gperf"
       {"height",                 tok_height,                 0},
       {""}, {""},
 #line 52 "locfile-kw.gperf"
@@ -213,7 +213,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""},
 #line 142 "locfile-kw.gperf"
       {"era_d_fmt",              tok_era_d_fmt,              0},
-#line 187 "locfile-kw.gperf"
+#line 188 "locfile-kw.gperf"
       {"title",                  tok_title,                  0},
       {""}, {""},
 #line 149 "locfile-kw.gperf"
@@ -243,7 +243,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {"duo_n_cs_precedes",      tok_duo_n_cs_precedes,      0},
 #line 127 "locfile-kw.gperf"
       {"thousands_sep",          tok_thousands_sep,          0},
-#line 195 "locfile-kw.gperf"
+#line 196 "locfile-kw.gperf"
       {"territory",              tok_territory,              0},
 #line 36 "locfile-kw.gperf"
       {"digit",                  tok_digit,                  0},
@@ -258,7 +258,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""},
 #line 78 "locfile-kw.gperf"
       {"else",                   tok_else,                   0},
-#line 182 "locfile-kw.gperf"
+#line 183 "locfile-kw.gperf"
       {"int_select",             tok_int_select,             0},
       {""}, {""}, {""},
 #line 132 "locfile-kw.gperf"
@@ -266,11 +266,11 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 33 "locfile-kw.gperf"
       {"upper",                  tok_upper,                  0},
       {""}, {""},
-#line 192 "locfile-kw.gperf"
+#line 193 "locfile-kw.gperf"
       {"tel",                    tok_tel,                    0},
 #line 93 "locfile-kw.gperf"
       {"p_sep_by_space",         tok_p_sep_by_space,         0},
-#line 158 "locfile-kw.gperf"
+#line 159 "locfile-kw.gperf"
       {"width",                  tok_width,                  0},
       {""},
 #line 98 "locfile-kw.gperf"
@@ -301,7 +301,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""}, {""}, {""}, {""}, {""},
 #line 58 "locfile-kw.gperf"
       {"section-symbol",         tok_section_symbol,         0},
-#line 183 "locfile-kw.gperf"
+#line 184 "locfile-kw.gperf"
       {"int_prefix",             tok_int_prefix,             0},
       {""}, {""}, {""}, {""},
 #line 42 "locfile-kw.gperf"
@@ -318,7 +318,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {"duo_p_sep_by_space",     tok_duo_p_sep_by_space,     0},
 #line 118 "locfile-kw.gperf"
       {"duo_int_p_sign_posn",    tok_duo_int_p_sign_posn,    0},
-#line 155 "locfile-kw.gperf"
+#line 156 "locfile-kw.gperf"
       {"nostr",                  tok_nostr,                  0},
       {""}, {""},
 #line 140 "locfile-kw.gperf"
@@ -327,26 +327,26 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 84 "locfile-kw.gperf"
       {"currency_symbol",        tok_currency_symbol,        0},
       {""},
-#line 165 "locfile-kw.gperf"
+#line 166 "locfile-kw.gperf"
       {"name_ms",                tok_name_ms,                0},
-#line 163 "locfile-kw.gperf"
-      {"name_mrs",               tok_name_mrs,               0},
 #line 164 "locfile-kw.gperf"
+      {"name_mrs",               tok_name_mrs,               0},
+#line 165 "locfile-kw.gperf"
       {"name_miss",              tok_name_miss,              0},
 #line 83 "locfile-kw.gperf"
       {"int_curr_symbol",        tok_int_curr_symbol,        0},
-#line 188 "locfile-kw.gperf"
+#line 189 "locfile-kw.gperf"
       {"source",                 tok_source,                 0},
-#line 162 "locfile-kw.gperf"
+#line 163 "locfile-kw.gperf"
       {"name_mr",                tok_name_mr,                0},
-#line 161 "locfile-kw.gperf"
+#line 162 "locfile-kw.gperf"
       {"name_gen",               tok_name_gen,               0},
-#line 200 "locfile-kw.gperf"
+#line 201 "locfile-kw.gperf"
       {"date",                   tok_date,                   0},
       {""}, {""},
-#line 189 "locfile-kw.gperf"
+#line 190 "locfile-kw.gperf"
       {"address",                tok_address,                0},
-#line 160 "locfile-kw.gperf"
+#line 161 "locfile-kw.gperf"
       {"name_fmt",               tok_name_fmt,               0},
 #line 32 "locfile-kw.gperf"
       {"copy",                   tok_copy,                   0},
@@ -365,16 +365,16 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 117 "locfile-kw.gperf"
       {"duo_n_sign_posn",        tok_duo_n_sign_posn,        0},
       {""},
-#line 168 "locfile-kw.gperf"
+#line 169 "locfile-kw.gperf"
       {"country_name",           tok_country_name,           0},
 #line 71 "locfile-kw.gperf"
       {"reorder-after",          tok_reorder_after,          0},
       {""}, {""},
-#line 153 "locfile-kw.gperf"
+#line 154 "locfile-kw.gperf"
       {"noexpr",                 tok_noexpr,                 0},
 #line 50 "locfile-kw.gperf"
       {"tolower",                tok_tolower,                0},
-#line 196 "locfile-kw.gperf"
+#line 197 "locfile-kw.gperf"
       {"audience",               tok_audience,               0},
       {""}, {""}, {""},
 #line 49 "locfile-kw.gperf"
@@ -395,7 +395,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""},
 #line 102 "locfile-kw.gperf"
       {"int_p_sign_posn",        tok_int_p_sign_posn,        0},
-#line 173 "locfile-kw.gperf"
+#line 174 "locfile-kw.gperf"
       {"country_car",            tok_country_car,            0},
       {""}, {""},
 #line 104 "locfile-kw.gperf"
@@ -406,9 +406,9 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""}, {""},
 #line 116 "locfile-kw.gperf"
       {"duo_p_sign_posn",        tok_duo_p_sign_posn,        0},
-#line 185 "locfile-kw.gperf"
+#line 186 "locfile-kw.gperf"
       {"measurement",            tok_measurement,            0},
-#line 174 "locfile-kw.gperf"
+#line 175 "locfile-kw.gperf"
       {"country_isbn",           tok_country_isbn,           0},
 #line 37 "locfile-kw.gperf"
       {"outdigit",               tok_outdigit,               0},
@@ -418,9 +418,9 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""}, {""}, {""},
 #line 34 "locfile-kw.gperf"
       {"lower",                  tok_lower,                  0},
-#line 181 "locfile-kw.gperf"
+#line 182 "locfile-kw.gperf"
       {"tel_dom_fmt",            tok_tel_dom_fmt,            0},
-#line 169 "locfile-kw.gperf"
+#line 170 "locfile-kw.gperf"
       {"country_post",           tok_country_post,           0},
 #line 148 "locfile-kw.gperf"
       {"cal_direction",          tok_cal_direction,          0},
@@ -430,7 +430,7 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 91 "locfile-kw.gperf"
       {"frac_digits",            tok_frac_digits,            0},
       {""}, {""},
-#line 175 "locfile-kw.gperf"
+#line 176 "locfile-kw.gperf"
       {"lang_name",              tok_lang_name,              0},
 #line 90 "locfile-kw.gperf"
       {"int_frac_digits",        tok_int_frac_digits,        0},
@@ -445,7 +445,7 @@  locfile_hash (register const char *str, register unsigned
int len)
       {""}, {""}, {""}, {""},
 #line 107 "locfile-kw.gperf"
       {"duo_frac_digits",        tok_duo_frac_digits,        0},
-#line 180 "locfile-kw.gperf"
+#line 181 "locfile-kw.gperf"
       {"tel_int_fmt",            tok_tel_int_fmt,            0},
 #line 123 "locfile-kw.gperf"
       {"duo_valid_to",           tok_duo_valid_to,           0},
@@ -455,7 +455,7 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 130 "locfile-kw.gperf"
       {"abday",                  tok_abday,                  0},
       {""},
-#line 198 "locfile-kw.gperf"
+#line 199 "locfile-kw.gperf"
       {"abbreviation",           tok_abbreviation,           0},
 #line 147 "locfile-kw.gperf"
       {"first_workday",          tok_first_workday,          0},
@@ -472,12 +472,12 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 45 "locfile-kw.gperf"
       {"blank",                  tok_blank,                  0},
       {""}, {""},
-#line 194 "locfile-kw.gperf"
+#line 195 "locfile-kw.gperf"
       {"language",               tok_language,               0},
 #line 120 "locfile-kw.gperf"
       {"uno_valid_from",         tok_uno_valid_from,         0},
       {""},
-#line 197 "locfile-kw.gperf"
+#line 198 "locfile-kw.gperf"
       {"application",            tok_application,            0},
       {""},
 #line 80 "locfile-kw.gperf"
@@ -498,7 +498,7 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 96 "locfile-kw.gperf"
       {"p_sign_posn",            tok_p_sign_posn,            0},
       {""},
-#line 201 "locfile-kw.gperf"
+#line 202 "locfile-kw.gperf"
       {"category",               tok_category,               0},
       {""}, {""}, {""}, {""},
 #line 134 "locfile-kw.gperf"
@@ -510,29 +510,29 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 63 "locfile-kw.gperf"
       {"order_start",            tok_order_start,            0},
       {""}, {""}, {""}, {""}, {""},
-#line 176 "locfile-kw.gperf"
+#line 177 "locfile-kw.gperf"
       {"lang_ab",                tok_lang_ab,                0},
-#line 178 "locfile-kw.gperf"
+#line 179 "locfile-kw.gperf"
       {"lang_lib",               tok_lang_lib,               0},
       {""}, {""}, {""},
-#line 190 "locfile-kw.gperf"
+#line 191 "locfile-kw.gperf"
       {"contact",                tok_contact,                0},
       {""}, {""}, {""},
-#line 171 "locfile-kw.gperf"
+#line 172 "locfile-kw.gperf"
       {"country_ab3",            tok_country_ab3,            0},
       {""}, {""}, {""},
-#line 191 "locfile-kw.gperf"
+#line 192 "locfile-kw.gperf"
       {"email",                  tok_email,                  0},
-#line 170 "locfile-kw.gperf"
+#line 171 "locfile-kw.gperf"
       {"country_ab2",            tok_country_ab2,            0},
       {""}, {""}, {""},
 #line 55 "locfile-kw.gperf"
       {"default_missing",        tok_default_missing,        0},
       {""}, {""},
-#line 193 "locfile-kw.gperf"
+#line 194 "locfile-kw.gperf"
       {"fax",                    tok_fax,                    0},
       {""}, {""}, {""}, {""}, {""}, {""}, {""},
-#line 172 "locfile-kw.gperf"
+#line 173 "locfile-kw.gperf"
       {"country_num",            tok_country_num,            0},
       {""}, {""}, {""}, {""}, {""}, {""},
 #line 51 "locfile-kw.gperf"
@@ -548,7 +548,9 @@  locfile_hash (register const char *str, register unsigned
int len)
       {"endif",                  tok_endif,                  0},
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
-      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
+#line 151 "locfile-kw.gperf"
+      {"alt_mon",                tok_alt_mon,                0},
       {""}, {""}, {""}, {""}, {""}, {""}, {""},
 #line 76 "locfile-kw.gperf"
       {"undef",                  tok_undef,                  0},
@@ -569,7 +571,7 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 85 "locfile-kw.gperf"
       {"mon_decimal_point",      tok_mon_decimal_point,      0},
       {""}, {""},
-#line 167 "locfile-kw.gperf"
+#line 168 "locfile-kw.gperf"
       {"postal_fmt",             tok_postal_fmt,             0},
       {""}, {""}, {""}, {""}, {""},
 #line 60 "locfile-kw.gperf"
@@ -588,7 +590,7 @@  locfile_hash (register const char *str, register unsigned
int len)
 #line 87 "locfile-kw.gperf"
       {"mon_grouping",           tok_mon_grouping,           0},
       {""},
-#line 177 "locfile-kw.gperf"
+#line 178 "locfile-kw.gperf"
       {"lang_term",              tok_lang_term,              0},
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h
index d6e7a8b..1a0afb2 100644
--- a/locale/programs/locfile-token.h
+++ b/locale/programs/locfile-token.h
@@ -186,6 +186,7 @@  enum token_t
   tok_cal_direction,
   tok_timezone,
   tok_date_fmt,
+  tok_alt_mon,
   tok_lc_messages,
   tok_yesexpr,
   tok_noexpr,