summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-12-17 11:39:19 +0000
committerBruno Haible <bruno@clisp.org>2009-06-21 23:45:37 +0200
commit28e4f6984b1ea72f0717e871de44de0651516d8f (patch)
tree9a04faa5b310666167e976e78354dff01e0ad52d /src
parentc425da4198900b8b4c5d81cfa0c57ed632497867 (diff)
downloadexternal_gettext-28e4f6984b1ea72f0717e871de44de0651516d8f.zip
external_gettext-28e4f6984b1ea72f0717e871de44de0651516d8f.tar.gz
external_gettext-28e4f6984b1ea72f0717e871de44de0651516d8f.tar.bz2
Enable marking of plural messages as c-format, lisp-format etc.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xgettext.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5a644ea..8de5919 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2001-12-15 Bruno Haible <bruno@clisp.org>
+ * xgettext.c (remember_a_message_plural): Mark the message as xx-format
+ if the English plural form has xx format syntax and the singular form
+ may or may not have xx format syntax.
+
+2001-12-15 Bruno Haible <bruno@clisp.org>
+
* format.h (struct formatstring_parser): Add 'equality' and
'pretty_msgstr' arguments to 'check' field.
* format-c.c (format_check): Add 'equality' and 'pretty_msgstr'
diff --git a/src/xgettext.c b/src/xgettext.c
index 3ce6e78..5a21ccd 100644
--- a/src/xgettext.c
+++ b/src/xgettext.c
@@ -1054,6 +1054,7 @@ remember_a_message_plural (mp, string, pos)
char *msgstr1;
size_t msgstr1_len;
char *msgstr;
+ size_t i;
msgid_plural = string;
@@ -1081,6 +1082,29 @@ remember_a_message_plural (mp, string, pos)
memcpy (msgstr + mp->msgstr_len, msgstr1, msgstr1_len);
mp->msgstr = msgstr;
mp->msgstr_len = mp->msgstr_len + msgstr1_len;
+
+ /* If it is not already decided, through programmer comments or
+ the msgid, whether the msgid is a format string, examine the
+ msgid_plural. This is a heuristic. */
+ for (i = 0; i < NFORMATS; i++)
+ if (formatstring_parsers[i] == current_formatstring_parser
+ && (mp->is_format[i] == undecided || mp->is_format[i] == possible))
+ {
+ struct formatstring_parser *parser = formatstring_parsers[i];
+ void *descr = parser->parse (mp->msgid_plural);
+
+ if (descr != NULL)
+ {
+ /* Same heuristic as in remember_a_message. */
+ if (parser->get_number_of_directives (descr) > 0)
+ mp->is_format[i] = possible;
+
+ parser->free (descr);
+ }
+ else
+ /* msgid_plural is not a valid format string. */
+ mp->is_format[i] = impossible;
+ }
}
else
free (msgid_plural);