[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gettext] msgattrib --previous
From: |
Ineiev |
Subject: |
Re: [bug-gettext] msgattrib --previous |
Date: |
Mon, 20 May 2013 14:36:30 +0000 |
On 05/20/2013 10:52 AM, Daiki Ueno wrote:
Sounds plausible and the patch looks good.
Can I have the ChangeLog entry?
Will the attached do?
>From 8d0c238c300ad041042119164e3ab438ffd333b5 Mon Sep 17 00:00:00 2001
From: Pavel Kharitonov <address@hidden>
Date: Mon, 20 May 2013 10:24:12 -0400
Subject: [PATCH] Add --previous option.
---
ChangeLog | 4 ++++
NEWS | 3 +++
gettext-tools/doc/ChangeLog | 4 ++++
gettext-tools/doc/msgattrib.texi | 30 ++++++++++++++++++++++++++++++
gettext-tools/src/ChangeLog | 5 +++++
gettext-tools/src/msgattrib.c | 29 +++++++++++++++++++++++++++--
6 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5a040d6..b0dfd93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-20 Pavel Kharitonov <address@hidden>
+
+ * NEWS: Mention --previous msgattrib option.
+
2013-04-17 Daiki Ueno <address@hidden>
* NEWS: Mention JavaScript support.
diff --git a/NEWS b/NEWS
index 74ea141..8483c68 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ Version 0.18.3 - unreleased
xgettext now supports JavaScript.
+* msgattrib now has --previous option to keep previous msgid
+ when making messages fuzzy.
+
Version 0.18.2 - December 2012
diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog
index 6eccb06..eb0fb77 100644
--- a/gettext-tools/doc/ChangeLog
+++ b/gettext-tools/doc/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-20 Pavel Kharitonov <address@hidden>
+
+ * msgattrib.texi: Document --previous.
+
2013-04-17 Andreas Stricker <address@hidden>
Support for JavaScript.
diff --git a/gettext-tools/doc/msgattrib.texi b/gettext-tools/doc/msgattrib.texi
index 39fe7ee..76df3da 100644
--- a/gettext-tools/doc/msgattrib.texi
+++ b/gettext-tools/doc/msgattrib.texi
@@ -1,3 +1,22 @@
address@hidden Copyright (C) 2001-2013 Free Software Foundation, Inc.
address@hidden
address@hidden This manual is free documentation. It is dually licensed under
the
address@hidden GNU FDL and the GNU GPL. This means that you can redistribute
this
address@hidden manual under either of these two licenses, at your choice.
address@hidden
address@hidden This manual is covered by the GNU FDL. Permission is granted to
copy,
address@hidden distribute and/or modify this document under the terms of the
address@hidden GNU Free Documentation License (FDL), either version 1.2 of the
address@hidden License, or (at your option) any later version published by the
address@hidden Free Software Foundation (FSF); with no Invariant Sections, with
no
address@hidden Front-Cover Text, and with no Back-Cover Texts.
address@hidden A copy of the license is included in fdl.texi.
address@hidden
address@hidden This manual is covered by the GNU GPL. You can redistribute it
and/or
address@hidden modify it under the terms of the GNU General Public License
(GPL), either
address@hidden version 2 of the License, or (at your option) any later version
published
address@hidden by the Free Software Foundation (FSF).
+
@pindex msgattrib
@cindex @code{msgattrib} program, usage
@example
@@ -122,6 +141,17 @@ Set all messages obsolete.
@opindex address@hidden, @code{msgattrib} option}
Set all messages non-obsolete.
address@hidden --previous
address@hidden address@hidden, @code{msgattrib} option}
+When setting
address@hidden
+âfuzzyâ
address@hidden ifhtml
address@hidden
+`fuzzy'
address@hidden ifnothtml
+mark, keep ``previous msgid'' of translated messages.
+
@item --clear-previous
@opindex address@hidden, @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 f1aa644..2e4c061 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-20 Pavel Kharitonov <address@hidden>
+
+ * msgattrib.c (long_options, main, process_message_list):
+ (usage): Add --previous option.
+
2013-04-18 Daiki Ueno <address@hidden>
* xgettext.c (usage): Wrap long lines in --help output.
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. */
--
1.8.2.1