+2014-05-10 Guido Flohr <guido@imperia.net>
+
+ msgattrib: Add --empty option to clear msgstr
+ * msgattrib.texi: Document --empty option.
+
2014-05-05 Daiki Ueno <ueno@gnu.org>
* gettext.texi (Translations under Version Control): New section.
@opindex --clear-previous@r{, @code{msgattrib} option}
Remove the ``previous msgid'' (@samp{#|}) comments from all messages.
+@item --empty
+@opindex --empty@r{, @code{msgattrib} option}
+When removing
+@ifhtml
+‘fuzzy’
+@end ifhtml
+@ifnothtml
+`fuzzy'
+@end ifnothtml
+mark, also set msgstr empty.
+
@item --only-file=@var{file}
@opindex --only-file@r{, @code{msgattrib} option}
Limit the attribute changes to entries that are listed in @var{file}.
+2014-05-10 Guido Flohr <guido@imperia.net>
+
+ msgattrib: Add --empty option to clear msgstr
+ * msgattrib.c (REMOVE_TRANSLATION): New enum value.
+ (long_options): Add --empty.
+ (main): Set REMOVE_TRANSLATION flag when --empty is given.
+ (usage): Show help of --empty.
+ (process_message_list): Handle REMOVE_TRANSLATION flag.
+
2014-05-09 Daiki Ueno <ueno@gnu.org>
vala: Interpret string literals lazily
SET_OBSOLETE = 1 << 2,
RESET_OBSOLETE = 1 << 3,
REMOVE_PREV = 1 << 4,
- ADD_PREV = 1 << 5
+ ADD_PREV = 1 << 5,
+ REMOVE_TRANSLATION = 1 << 6
};
static int to_change;
{ "clear-fuzzy", no_argument, NULL, CHAR_MAX + 8 },
{ "clear-obsolete", no_argument, NULL, CHAR_MAX + 10 },
{ "clear-previous", no_argument, NULL, CHAR_MAX + 18 },
+ { "empty", no_argument, NULL, CHAR_MAX + 23 },
{ "color", optional_argument, NULL, CHAR_MAX + 19 },
{ "directory", required_argument, NULL, 'D' },
{ "escape", no_argument, NULL, 'E' },
message_print_style_filepos (filepos_comment_none);
break;
+ case CHAR_MAX + 23: /* --empty */
+ to_change |= REMOVE_TRANSLATION;
+ break;
+
default:
usage (EXIT_FAILURE);
/* NOTREACHED */
printf (_("\
--clear-previous remove the \"previous msgid\" from all messages\n"));
printf (_("\
+ --empty when removing 'fuzzy', also set msgstr empty\n"));
+ printf (_("\
--only-file=FILE.po manipulate only entries listed in FILE.po\n"));
printf (_("\
--ignore-file=FILE.po manipulate only entries not listed in FILE.po\n"));
}
if (to_change & RESET_FUZZY)
- mp->is_fuzzy = false;
+ {
+ if ((to_change & REMOVE_TRANSLATION)
+ && mp->is_fuzzy && !mp->obsolete)
+ {
+ unsigned long int nplurals = 0;
+ char *msgstr;
+ size_t pos;
+
+ for (pos = 0; pos < mp->msgstr_len; ++pos)
+ if (!mp->msgstr[pos])
+ ++nplurals;
+ free ((char *) mp->msgstr);
+ msgstr = XNMALLOC (nplurals, char);
+ memset (msgstr, '\0', nplurals);
+ mp->msgstr = msgstr;
+ mp->msgstr_len = nplurals;
+ }
+ mp->is_fuzzy = false;
+ }
/* Always keep the header entry non-obsolete. */
if ((to_change & SET_OBSOLETE) && !is_header (mp))
mp->obsolete = true;
+2014-05-10 Guido Flohr <guido@imperia.net>
+
+ msgattrib: Add --empty option to clear msgstr
+ * msgattrib-19: New test.
+ * Makefile.am (TESTS): Add new test.
+
2014-05-09 Daiki Ueno <ueno@gnu.org>
vala: Interpret string literals lazily
msgattrib-1 msgattrib-2 msgattrib-3 msgattrib-4 msgattrib-5 \
msgattrib-6 msgattrib-7 msgattrib-8 msgattrib-9 msgattrib-10 \
msgattrib-11 msgattrib-12 msgattrib-13 msgattrib-14 msgattrib-15 \
- msgattrib-16 msgattrib-17 msgattrib-18 \
+ msgattrib-16 msgattrib-17 msgattrib-18 msgattrib-19 \
msgattrib-properties-1 \
msgcat-1 msgcat-2 msgcat-3 msgcat-4 msgcat-5 msgcat-6 msgcat-7 \
msgcat-8 msgcat-9 msgcat-10 msgcat-11 msgcat-12 msgcat-13 msgcat-14 \
--- /dev/null
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test --empty option.
+
+cat <<\EOF > ma-test19.po
+# HEADER.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Bonnie Tyler\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: married-men:4
+#, fuzzy
+msgid "The world is full of married men"
+msgstr "So viele verheiratete Männer"
+
+#: married-men:5
+msgid "with wives who never understand"
+msgstr "und ihre Frauen verstehen sie nicht"
+
+#: married-men:6
+msgid "They're looking for someone to share"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "One file deleted."
+msgid_plural "%u files deleted."
+msgstr[0] "Ein Fehler."
+msgstr[1] "%u Fehler."
+
+#~ msgid "You fly on the wings of romance"
+#~ msgstr "Die Flügel der frischen Liebe heben dich zum Himmel"
+
+#, fuzzy
+#~ msgid "In the eyes of the world"
+#~ msgstr "Für die anderen"
+EOF
+
+: ${MSGATTRIB=msgattrib}
+${MSGATTRIB} --clear-fuzzy --empty -o ma-test19.tmp ma-test19.po \
+ || exit 1
+LC_ALL=C tr -d '\r' < ma-test19.tmp > ma-test19.out || exit 1
+
+cat <<\EOF > ma-test19.ok
+# HEADER.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Bonnie Tyler\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: married-men:4
+msgid "The world is full of married men"
+msgstr ""
+
+#: married-men:5
+msgid "with wives who never understand"
+msgstr "und ihre Frauen verstehen sie nicht"
+
+#: married-men:6
+msgid "They're looking for someone to share"
+msgstr ""
+
+#, c-format
+msgid "One file deleted."
+msgid_plural "%u files deleted."
+msgstr[0] ""
+msgstr[1] ""
+
+#~ msgid "You fly on the wings of romance"
+#~ msgstr "Die Flügel der frischen Liebe heben dich zum Himmel"
+
+#~ msgid "In the eyes of the world"
+#~ msgstr "Für die anderen"
+EOF
+
+: ${DIFF=diff}
+${DIFF} ma-test19.ok ma-test19.out
+result=$?
+
+cp ma-test19.ok ma-test19.out /tmp
+
+exit $result