* msgexec.c (process_string): Set or unset MSGEXEC_MSGID_PLURAL.
(process_message): Set or unset MSGEXEC_PLURAL_FORM.
+2014-05-15 Stanislav Brabec <sbrabec@suse.cz> (tiny change)
+
+ * msgexec.texi: Document the environment variable
+ MSGEXEC_MSGID_PLURAL and MSGEXEC_PLURAL_FORM.
+
2014-05-10 Guido Flohr <guido@imperia.net>
msgattrib: Add --empty option to clear msgstr
@vindex MSGEXEC_MSGCTXT@r{, environment variable}
@vindex MSGEXEC_MSGID@r{, environment variable}
+@vindex MSGEXEC_MSGID_PLURAL@r{, environment variable}
@vindex MSGEXEC_LOCATION@r{, environment variable}
+@vindex MSGEXEC_PLURAL_FORM@r{, environment variable}
During each @var{command} invocation, the environment variable
@code{MSGEXEC_MSGID} is bound to the message's msgid, and the environment
variable @code{MSGEXEC_LOCATION} is bound to the location in the PO file
of the message. If the message has a context, the environment variable
@code{MSGEXEC_MSGCTXT} is bound to the message's msgctxt, otherwise it is
-unbound.
+unbound. If the message has a plural form, environment variable
+@code{MSGEXEC_MSGID_PLURAL} is bound to the message's msgid_plural and
+@code{MSGEXEC_PLURAL_FORM} is bound to the order number of the plural
+actually processed (starting with 0), otherwise both are unbound.
@cindex catalog encoding and @code{msgexec} output
Note: It is your responsibility to ensure that the @var{command} can cope
+2014-05-15 Stanislav Brabec <sbrabec@suse.cz> (tiny change)
+
+ msgexec: Implement plural support
+ * msgexec.c (process_string): Set or unset MSGEXEC_MSGID_PLURAL.
+ (process_message): Set or unset MSGEXEC_PLURAL_FORM.
+
2014-05-14 Daiki Ueno <ueno@gnu.org>
msgfmt: Report error on accelerator mismatch
else
unsetenv ("MSGEXEC_MSGCTXT");
xsetenv ("MSGEXEC_MSGID", mp->msgid, 1);
+ if (mp->msgid_plural != NULL)
+ xsetenv ("MSGEXEC_MSGID_PLURAL", mp->msgid_plural, 1);
+ else
+ unsetenv ("MSGEXEC_MSGID_PLURAL");
location = xasprintf ("%s:%ld", mp->pos.file_name,
(long) mp->pos.line_number);
xsetenv ("MSGEXEC_LOCATION", location, 1);
const char *msgstr = mp->msgstr;
size_t msgstr_len = mp->msgstr_len;
const char *p;
+ size_t k;
/* Process each NUL delimited substring separately. */
- for (p = msgstr; p < msgstr + msgstr_len; )
+ for (p = msgstr, k = 0; p < msgstr + msgstr_len; k++)
{
size_t length = strlen (p);
+ if (mp->msgid_plural != NULL)
+ {
+ char *plural_form_string = xasprintf ("%lu", k);
+
+ xsetenv ("MSGEXEC_PLURAL_FORM", plural_form_string, 1);
+ free (plural_form_string);
+ }
+ else
+ unsetenv ("MSGEXEC_PLURAL_FORM");
process_string (mp, p, length);
p += length + 1;