@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.
#include "write-stringtable.h"
#include "color.h"
#include "propername.h"
+#include "xalloc.h"
#include "gettext.h"
#define _(str) gettext (str)
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;
{ "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 },
handle_style_option (optarg);
break;
+ case CHAR_MAX + 21: /* --previous */
+ to_change |= ADD_PREV;
+ break;
+
default:
usage (EXIT_FAILURE);
/* NOTREACHED */
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"));
: 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. */