diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | gettext-tools/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gettext-tools/doc/msgattrib.texi | 11 | ||||
-rw-r--r-- | gettext-tools/src/ChangeLog | 6 | ||||
-rw-r--r-- | gettext-tools/src/msgattrib.c | 29 |
6 files changed, 57 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2013-05-20 Pavel Kharitonov <ineiev@gnu.org> (tiny change) + + Add --previous option to msgattrib. + * NEWS: Mention --previous msgattrib option. + 2013-05-13 Daiki Ueno <ueno@gnu.org> Fix bootstrap error on Mac OS X. @@ -15,6 +15,9 @@ Version 0.18.3 - unreleased xgettext and msgfmt's format string checking now recognize Python format string in braced syntax (PEP 3101). +* msgattrib now has --previous option to keep previous msgid when + making messages fuzzy, similar to msgmerge --previous. + Version 0.18.2 - December 2012 diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index 5cf3278..e5e7529 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -1,3 +1,8 @@ +2013-05-20 Pavel Kharitonov <ineiev@gnu.org> (tiny change) + + Add --previous option to msgattrib. + * msgattrib.texi: Document --previous. + 2013-04-26 Daiki Ueno <ueno@gnu.org> Support for Python brace format. diff --git a/gettext-tools/doc/msgattrib.texi b/gettext-tools/doc/msgattrib.texi index 39fe7ee..0f2749b 100644 --- a/gettext-tools/doc/msgattrib.texi +++ b/gettext-tools/doc/msgattrib.texi @@ -122,6 +122,17 @@ Set all messages obsolete. @opindex --clear-obsolete@r{, @code{msgattrib} option} Set all messages non-obsolete. +@item --previous +@opindex --previous@r{, @code{msgattrib} option} +When setting +@ifhtml +‘fuzzy’ +@end ifhtml +@ifnothtml +`fuzzy' +@end ifnothtml +mark, keep ``previous msgid'' of translated messages. + @item --clear-previous @opindex --clear-previous@r{, @code{msgattrib} option} Remove the ``previous msgid'' (@samp{#|}) comments from all messages. diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index d329dfc..42fc54d 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,9 @@ +2013-05-20 Pavel Kharitonov <ineiev@gnu.org> (tiny change) + + Add --previous option to msgattrib. + * msgattrib.c (long_options, main, process_message_list): + (usage): Add --previous option. + 2013-05-12 Daiki Ueno <ueno@gnu.org> Fix end-of-string handling in JavaScript scanner. diff --git a/gettext-tools/src/msgattrib.c b/gettext-tools/src/msgattrib.c index 75a9785..7732315 100644 --- a/gettext-tools/src/msgattrib.c +++ b/gettext-tools/src/msgattrib.c @@ -44,6 +44,7 @@ #include "write-stringtable.h" #include "color.h" #include "propername.h" +#include "xalloc.h" #include "gettext.h" #define _(str) gettext (str) @@ -71,7 +72,8 @@ enum RESET_FUZZY = 1 << 1, SET_OBSOLETE = 1 << 2, RESET_OBSOLETE = 1 << 3, - REMOVE_PREV = 1 << 4 + REMOVE_PREV = 1 << 4, + ADD_PREV = 1 << 5 }; static int to_change; @@ -100,6 +102,7 @@ static const struct option long_options[] = { "only-fuzzy", no_argument, NULL, CHAR_MAX + 4 }, { "only-obsolete", no_argument, NULL, CHAR_MAX + 6 }, { "output-file", required_argument, NULL, 'o' }, + { "previous", no_argument, NULL, CHAR_MAX + 21 }, { "properties-input", no_argument, NULL, 'P' }, { "properties-output", no_argument, NULL, 'p' }, { "set-fuzzy", no_argument, NULL, CHAR_MAX + 7 }, @@ -324,6 +327,10 @@ main (int argc, char **argv) handle_style_option (optarg); break; + case CHAR_MAX + 21: /* --previous */ + to_change |= ADD_PREV; + break; + default: usage (EXIT_FAILURE); /* NOTREACHED */ @@ -459,6 +466,9 @@ Attribute manipulation:\n")); printf (_("\ --clear-obsolete set all messages non-obsolete\n")); printf (_("\ + --previous when setting 'fuzzy', keep previous msgids\n\ + of translated messages.\n")); + printf (_("\ --clear-previous remove the \"previous msgid\" from all messages\n")); printf (_("\ --only-file=FILE.po manipulate only entries listed in FILE.po\n")); @@ -587,7 +597,22 @@ process_message_list (message_list_ty *mlp, : true)) { if (to_change & SET_FUZZY) - mp->is_fuzzy = true; + { + if ((to_change & ADD_PREV) && !is_header (mp) + && !mp->is_fuzzy && mp->msgstr[0] != '\0') + { + mp->prev_msgctxt = + (mp->msgctxt != NULL ? xstrdup (mp->msgctxt) : NULL); + mp->prev_msgid = + (mp->msgid != NULL ? xstrdup (mp->msgid) : NULL); + mp->prev_msgid_plural = + (mp->msgid_plural != NULL + ? xstrdup (mp->msgid_plural) + : NULL); + } + mp->is_fuzzy = true; + } + if (to_change & RESET_FUZZY) mp->is_fuzzy = false; /* Always keep the header entry non-obsolete. */ |