summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src/msgmerge.c
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/src/msgmerge.c')
-rw-r--r--gettext-tools/src/msgmerge.c61
1 files changed, 47 insertions, 14 deletions
diff --git a/gettext-tools/src/msgmerge.c b/gettext-tools/src/msgmerge.c
index 22dbf53..87bd713 100644
--- a/gettext-tools/src/msgmerge.c
+++ b/gettext-tools/src/msgmerge.c
@@ -561,7 +561,7 @@ message_merge (message_ty *def, message_ty *ref)
/* Take the msgstr from the definition. The msgstr of the reference
is usually empty, as it was generated by xgettext. If we currently
process the header entry we have to merge the msgstr by using the
- POT-Creation-Date field from the reference. */
+ Report-Msgid-Bugs-To and POT-Creation-Date fields from the reference. */
if (ref->msgid[0] == '\0')
{
/* Oh, oh. The header entry and we have something to fill in. */
@@ -572,24 +572,26 @@ message_merge (message_ty *def, message_ty *ref)
} known_fields[] =
{
{ "Project-Id-Version:", sizeof ("Project-Id-Version:") - 1 },
-#define PROJECT_ID 0
+#define PROJECT_ID 0
+ { "Report-Msgid-Bugs-To:", sizeof ("Report-Msgid-Bugs-To:") - 1 },
+#define REPORT_MSGID_BUGS_TO 1
{ "POT-Creation-Date:", sizeof ("POT-Creation-Date:") - 1 },
-#define POT_CREATION 1
+#define POT_CREATION_DATE 2
{ "PO-Revision-Date:", sizeof ("PO-Revision-Date:") - 1 },
-#define PO_REVISION 2
+#define PO_REVISION_DATE 3
{ "Last-Translator:", sizeof ("Last-Translator:") - 1 },
-#define LAST_TRANSLATOR 3
+#define LAST_TRANSLATOR 4
{ "Language-Team:", sizeof ("Language-Team:") - 1 },
-#define LANGUAGE_TEAM 4
+#define LANGUAGE_TEAM 5
{ "MIME-Version:", sizeof ("MIME-Version:") - 1 },
-#define MIME_VERSION 5
+#define MIME_VERSION 6
{ "Content-Type:", sizeof ("Content-Type:") - 1 },
-#define CONTENT_TYPE 6
+#define CONTENT_TYPE 7
{ "Content-Transfer-Encoding:",
sizeof ("Content-Transfer-Encoding:") - 1 }
-#define CONTENT_TRANSFER 7
+#define CONTENT_TRANSFER 8
};
-#define UNKNOWN 8
+#define UNKNOWN 9
struct
{
const char *string;
@@ -657,6 +659,36 @@ message_merge (message_ty *def, message_ty *ref)
}
{
+ const char *msgid_bugs_ptr;
+
+ msgid_bugs_ptr = strstr (ref->msgstr, "Report-Msgid-Bugs-To:");
+ if (msgid_bugs_ptr != NULL)
+ {
+ size_t msgid_bugs_len;
+ const char *endp;
+
+ msgid_bugs_ptr += sizeof ("Report-Msgid-Bugs-To:") - 1;
+
+ endp = strchr (msgid_bugs_ptr, '\n');
+ if (endp == NULL)
+ {
+ /* Add a trailing newline. */
+ char *extended;
+ endp = strchr (msgid_bugs_ptr, '\0');
+ msgid_bugs_len = (endp - msgid_bugs_ptr) + 1;
+ extended = (char *) alloca (msgid_bugs_len + 1);
+ stpcpy (stpcpy (extended, msgid_bugs_ptr), "\n");
+ msgid_bugs_ptr = extended;
+ }
+ else
+ msgid_bugs_len = (endp - msgid_bugs_ptr) + 1;
+
+ header_fields[REPORT_MSGID_BUGS_TO].string = msgid_bugs_ptr;
+ header_fields[REPORT_MSGID_BUGS_TO].len = msgid_bugs_len;
+ }
+ }
+
+ {
const char *pot_date_ptr;
pot_date_ptr = strstr (ref->msgstr, "POT-Creation-Date:");
@@ -681,8 +713,8 @@ message_merge (message_ty *def, message_ty *ref)
else
pot_date_len = (endp - pot_date_ptr) + 1;
- header_fields[POT_CREATION].string = pot_date_ptr;
- header_fields[POT_CREATION].len = pot_date_len;
+ header_fields[POT_CREATION_DATE].string = pot_date_ptr;
+ header_fields[POT_CREATION_DATE].len = pot_date_len;
}
}
@@ -702,8 +734,9 @@ message_merge (message_ty *def, message_ty *ref)
header_fields[idx].string, header_fields[idx].len)
IF_FILLED (PROJECT_ID);
- IF_FILLED (POT_CREATION);
- IF_FILLED (PO_REVISION);
+ IF_FILLED (REPORT_MSGID_BUGS_TO);
+ IF_FILLED (POT_CREATION_DATE);
+ IF_FILLED (PO_REVISION_DATE);
IF_FILLED (LAST_TRANSLATOR);
IF_FILLED (LANGUAGE_TEAM);
IF_FILLED (MIME_VERSION);