trans-coord-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trans-coord/gnun/server/gnun AUTHORS ChangeLog ...


From: Pavel Kharitonov
Subject: trans-coord/gnun/server/gnun AUTHORS ChangeLog ...
Date: Thu, 21 Mar 2013 16:25:16 +0000

CVSROOT:        /sources/trans-coord
Module name:    trans-coord
Changes by:     Pavel Kharitonov <ineiev>       13/03/21 16:25:15

Modified files:
        gnun/server/gnun: AUTHORS ChangeLog NEWS Makefile.am 
                          gnun-diff-po.in 
Added files:
        gnun/server/gnun: diff-po.awk.in 
Removed files:
        gnun/server/gnun: po-msg-diff.in 

Log message:
        Replace `po-msg-diff' with `diff-po.awk' in `gnun-diff-po'.
        Add comment differences to the generated table.
        
        * po-msg-diff.in: Remove.
        * diff-po.awk.in: New file.
        * Makefile.am: Replace `po-msg-diff.in' with `diff-po.awk.in'.
        * gnun-diff-po.in: Likewise; improve the headers of generated files.
        * AUTHORS: Update.
        * NEWS: Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.365&r2=1.366
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.84&r2=1.85
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-diff-po.in?cvsroot=trans-coord&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/diff-po.awk.in?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/po-msg-diff.in?cvsroot=trans-coord&r1=1.2&r2=0

Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- AUTHORS     19 Nov 2012 15:14:10 -0000      1.14
+++ AUTHORS     21 Mar 2013 16:25:07 -0000      1.15
@@ -6,14 +6,13 @@
 Pavel Kharitonov <address@hidden>
 
     Add add-fuzzy-diff.in, copy-msgid.in, diff-page-head.html,
-        diff-page-tail.html, dtd/html5.dtd (based on W3C DTD),
+        diff-page-tail.html, diff-po.in,
+        dtd/html5.dtd (based on W3C DTD),
         expand-m4-includes.in, expand-ssi.awk,
         languages.txt (compiled from www.gnu.org pages),
         gnun-add-fuzzy-diff, gnun-diff-po.in,
         gnun-init-po.in, gnun-report.in, make-prototype.awk,
-        po-msg-diff.in, priorities.mk,
-        translinks-head.html, translinks-tail.html,
-        update-localized-urls.in.
+        priorities.mk, update-localized-urls.in.
 
     Some changes in configure.ac, GNUmakefile, GNUmakefile.team,
         gnun-validate-html.in, validate-html-notify.in,

Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.365
retrieving revision 1.366
diff -u -b -r1.365 -r1.366
--- ChangeLog   21 Mar 2013 04:25:51 -0000      1.365
+++ ChangeLog   21 Mar 2013 16:25:10 -0000      1.366
@@ -1,3 +1,17 @@
+2013-03-21  Pavel Kharitonov  <address@hidden>
+
+       Replace `po-msg-diff' with `diff-po.awk' in `gnun-diff-po'.
+       Add comment differences to the generated table.
+
+       * po-msg-diff.in: Remove.
+       * diff-po.awk.in: New file.
+       * Makefile.am: Replace `po-msg-diff.in' with
+       `diff-po.awk.in'.
+       * gnun-diff-po.in: Likewise; improve the headers
+       of generated files.
+       * AUTHORS: Update.
+       * NEWS: Likewise.
+
 2013-03-20  Pavel Kharitonov  <address@hidden>
 
        * GNUmakefile.team (cmp-POs): Rewrap lines before

Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- NEWS        21 Mar 2013 04:25:50 -0000      1.84
+++ NEWS        21 Mar 2013 16:25:10 -0000      1.85
@@ -10,6 +10,9 @@
 
 *** Support of sitemaps was added.
 
+*** The differences of comments were added to the tables generated
+    with `gnun-diff-po'.
+
 ** Bugs fixed in 0.8.
 
 *** `gnun-diff-po' didn't highlight the differences in the messages

Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- Makefile.am 19 Nov 2012 15:14:25 -0000      1.34
+++ Makefile.am 21 Mar 2013 16:25:10 -0000      1.35
@@ -1,4 +1,5 @@
-# Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011, 2012,
+#   2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -45,7 +46,7 @@
 pkglibexec_SCRIPTS += add-fuzzy-diff
 if HAVE_GETTEXT
 bin_SCRIPTS += gnun-diff-po
-pkglibexec_SCRIPTS += po-msg-diff
+pkglibexec_SCRIPTS += diff-po.awk
 endif
 endif
 
@@ -74,7 +75,7 @@
 
 add-fuzzy-diff copy-msgid expand-m4-includes gnun-add-fuzzy-diff \
 gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
-gnun-validate-html po-msg-diff update-localized-urls \
+gnun-validate-html diff-po.awk update-localized-urls \
 validate-html-notify: Makefile
        $(AM_V_at)rm -f $@ address@hidden
        $(AM_V_GEN)$(edit) '$(srcdir)/address@hidden' >address@hidden
@@ -95,7 +96,7 @@
 gnun-merge-preconverted: $(srcdir)/gnun-merge-preconverted.in
 gnun-report: $(srcdir)/gnun-report.in
 gnun-validate-html: $(srcdir)/gnun-validate-html.in
-po-msg-diff: $(srcdir)/po-msg-diff.in
+diff-po.awk: $(srcdir)/diff-po.awk.in
 update-localized-urls: $(srcdir)/update-localized-urls.in
 validate-html-notify: $(srcdir)/validate-html-notify.in
 
@@ -114,11 +115,11 @@
             gnun-add-fuzzy-diff.in gnun-diff-po.in \
             gnun-init-po.in gnun-merge-preconverted.in \
             gnun-report.in gnun-validate-html.in \
-            po-msg-diff.in update-localized-urls.in \
+            diff-po.awk.in update-localized-urls.in \
             validate-html-notify.in
 
 CLEANFILES = add-fuzzy-diff copy-msgid expand-m4-includes gnun-add-fuzzy-diff \
             gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
-            gnun-validate-html po-msg-diff \
+            gnun-validate-html diff-po.awk \
             update-localized-urls validate-html-notify \
             stamp-config.mk

Index: gnun-diff-po.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/gnun-diff-po.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gnun-diff-po.in     3 Jan 2013 14:59:28 -0000       1.5
+++ gnun-diff-po.in     21 Mar 2013 16:25:11 -0000      1.6
@@ -118,15 +118,18 @@
 trap 'rm -f "$temp" "$temp1" "$temp2" "$temp3" "$temp4"' EXIT
 
 cat <<EOF
-<html> <!-- Generated by $0. -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<!-- Generated by $0. -->
 <title>$title (`date`)</title>
-<style>
+<style type="text/css">
   span.removed { background-color: #faa; color: #000 }
   span.inserted { background-color: #afa; color: #000 }
-  td.modified { background-color: #aff; color: #000 }
-  td.msgid { background-color: #ddd; color: #000 }
+  td.modified { background-color: #ffa; color: #000 }
+  td.msgid { background-color: #bbd; color: #000 }
 </style>
 </head>
 <body>
@@ -150,8 +153,7 @@
      "$merge_to" > $temp
   if @MSGMERGE@ -q "$merge_from" "$temp" > "$temp3" ; then
     cat <<EOF
-<p><em>Note:</em> the files have been merged in order to compare them (their
-set of original strings didn't coincide).</p>
+<p><em>Note:</em> the files have been merged in order to compare them.</p>
 EOF
   else
     cat <<EOF
@@ -176,10 +178,10 @@
 # Sed provides "empty" (from wdiff's point of view) translations
 # for untranslated msgids in order to show new and removed translations.
 @SED@ '/^msgstr ""/ { N; s/^msgstr ""\n$/msgstr " "\n/ }' "$to_file" \
-  | @MSGATTRIB@ --clear-fuzzy --no-obsolete - > "$temp4"
+  | @MSGATTRIB@ -w 79 --force-po --clear-fuzzy --no-obsolete - > "$temp4"
 @SED@ '/^msgstr ""/ { N; s/^msgstr ""\n$/msgstr " "\n/ }' "$from_file" \
-  | @MSGATTRIB@ --clear-fuzzy --no-obsolete - | @MSGCAT@ - "$temp4" \
-  | @MSGEXEC@ @pkglibexecdir@/po-msg-diff "$temp" "$temp1" "$temp2"
+  | @MSGATTRIB@ -w 79 --force-po --clear-fuzzy --no-obsolete - \
+  | @MSGCAT@ --force-po - "$temp4" | @AWK@ -f @pkglibexecdir@/diff-po.awk
 
 cat <<EOF
 </table>

Index: diff-po.awk.in
===================================================================
RCS file: diff-po.awk.in
diff -N diff-po.awk.in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ diff-po.awk.in      21 Mar 2013 16:25:13 -0000      1.1
@@ -0,0 +1,186 @@
+#! /usr/bin/awk -f
+
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations.  If not, see <http://www.gnu.org/licenses/>.
+
+# This script outputs differences between two msgcatted PO files
+# in the format of HTML table rows.  It is invoked from gnun-diff-po.
+
+function escape_chars(x) {
+  gsub(/&/, "\\&amp;", x)
+  gsub(/>/, "\\&gt;", x)
+  gsub(/</, "\\&lt;", x)
+  return x
+}
+
+function output_entry() {
+  if(comment_no || msgstr_no)
+    {
+      no_head = "<td rowspan=\"3\" class=\"modified\"><strong>"
+      no_tail = "</strong></td>"
+    }
+  else
+    {
+      no_head = "<td rowspan=\"3\">"
+      no_tail = "</td>"
+    }
+  print "<tr>" no_head msg_no no_tail
+  if(comment_no)
+    print "<td class=\"modified\"><strong>*</strong></td>"
+  else
+    print "<td>&nbsp;</td>"
+  print "<td class=\"comment\">"
+              
+  wdiff_cmd = "@WDIFF@ " \
+    "--start-delete \"<span class=\\\"removed\\\"><del><strong>\" " \
+    "--end-delete \"</strong></del></span>\" " \
+    "--start-insert \"<span class=\\\"inserted\\\"><ins><em>\" " \
+    "--end-insert \"</em></ins></span>\" " tmp_file[0] " " tmp_file[1]
+  if(comment_no)
+    {
+      print escape_chars(comment[1]) > tmp_file[0]
+      close(tmp_file[0])
+      print escape_chars(comment[2]) > tmp_file[1]
+      close(tmp_file[1])
+      while((wdiff_cmd | getline) > 0)
+        {
+          sub(/^[[:space:]]*$/, "&nbsp;")
+          print $0 "<br />"
+        }
+      close(wdiff_cmd)
+    }
+  else
+    {
+      if(comment[0] != "")
+        {
+          comment[0] = escape_chars(comment[0])
+          gsub(/\n/, "<br />\n", comment[0])
+        }
+      else
+        comment[0] = "&nbsp;"
+      print comment[0]
+    }
+  print "</td></tr>"
+  print "<tr><td class=\"msgid\">&nbsp;</td><td class=\"msgid\"><code>"
+  print escape_chars(msgid) "&nbsp;"
+  print "</code></td></tr>"
+  print "<tr>"
+  if(msgstr_no)
+    print "<td class=\"modified\"><strong>*</strong></td>"
+  else
+    print "<td>&nbsp;</td>"
+  print "<td class=\"msgstr\">"
+  if(msgstr_no)
+    {
+      sub(/\\n$/, "", msgstr[1])
+      print escape_chars(msgstr[1]) > tmp_file[0]
+      close(tmp_file[0])
+      print escape_chars(msgstr[2]) > tmp_file[1]
+      close(tmp_file[1])
+      while((wdiff_cmd | getline) > 0)
+        {
+          gsub(/\\n/, "<br />\n")
+          print
+        }
+      close(wdiff_cmd)
+      print "&nbsp;"
+    }
+  else
+    {
+      msgstr[0] = escape_chars(msgstr[0])
+      gsub(/\\n/, "<br />\n", msgstr[0])
+      print msgstr[0] "&nbsp;"
+    }
+  print "</td></tr>"
+  comment_no = 0
+  msgstr_no = 0
+  for(i = 0; i < 3; i++)
+    {
+      comment[i] = ""
+      msgstr[i] = ""
+    }
+  msg_no++
+}
+
+BEGIN {
+  msg_no = 0;
+  comment_no = 0;
+  msgstr_no = 0;
+  mktemp_cmd = "mktemp diff-po-tmp.XXXXXXXXXX"
+  mktemp_cmd | getline tmp_file[0]
+  close(mktemp_cmd)
+  mktemp_cmd | getline tmp_file[1]
+  close(mktemp_cmd)
+}
+
+END {
+ if(msgstr[0] msgstr[1] msgstr[2] != "")
+   output_entry()
+ system("rm " tmp_file[0] " " tmp_file[1])
+}
+
+/^msgid "/ {
+  state = "msgid"
+  sub(/^msgid "/, "")
+  sub(/"[[:space:]]*$/, "")
+  msgid = $0
+  next
+}
+
+/^msgstr "/ {
+  state = "msgstr"
+  sub(/^msgstr "/, "")
+  sub(/"[[:space:]]*$/, "")
+  msgstr[0] = $0
+  next
+}
+
+/^[[:space:]]*$/ {
+  output_entry()
+  next
+}
+
+/^# #-#-#-#-# .* #-#-#-#-#$/ {
+  comment_no++
+  next
+}
+
+/^# type: (Content|Attribute .*) of: / { next }
+/^# / {
+  sub(/# /, "")
+  if(comment[comment_no] == "")
+    comment[comment_no] = $0
+  else
+    comment[comment_no] = comment[comment_no] "\n" $0
+  next
+}
+
+/^"#-#-#-#-# .* #-#-#-#-#\\n"$/ {
+  msgstr_no++
+  next
+}
+
+/^"/ {
+  sub(/^"/, "")
+  sub(/"[[:space:]]*$/, "")
+  if(state == "msgid")
+    msgid = msgid $0
+  else
+    msgstr[msgstr_no] = msgstr[msgstr_no] $0
+}
+
+{ next }

Index: po-msg-diff.in
===================================================================
RCS file: po-msg-diff.in
diff -N po-msg-diff.in
--- po-msg-diff.in      16 Dec 2012 09:29:44 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-#! /bin/bash
-
-# Copyright (C) 2012 Free Software Foundation, Inc.
-
-# This file is part of GNUnited Nations.
-
-# GNUnited Nations is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-
-# GNUnited Nations is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNUnited Nations.  If not, see <http://www.gnu.org/licenses/>.
-
-# Output a part of a HTML table with highlighted difference
-# of translations of a single message based on msgcat `merging'
-# feature.  To be invoked from a separate script (gnun-diff-po) via msgexec.
-
-# $1 is the filename where incremented index of messages is kept.
-# $2 and $3 are names for temporary files.
-
-function escape-chars () {
-  @SED@ 's/&/\&amp;/g; s/>/\&gt;/g; s/</\&lt;/g'
-}
-
-i=`cat $1`
-
address@hidden@ \
-'1{/^#-#-#-#-# .* #-#-#-#-#$/d; :egin; n; begin; }
-2,/^#-#-#-#-# .* #-#-#-#-#$/{ H; d; }
-x; s/^\n//;  s/\n[^\n]*$//;w '$2'
-x;
-:read-second; n; b read-second;
-' | escape-chars > $3
-
-if test -s $2; then
-  begin="<td rowspan=\"2\" class=\"modified\"><strong>"
-  end="</strong></td>"
-  modified=yes
-else
-  begin="<td rowspan=\"2\">"
-  end="</td>"
-  modified=no
-fi
-
-case "x$MSGEXEC_MSGID" in
-  x ) msgid='&nbsp;' ;;
-  * ) msgid=`echo $MSGEXEC_MSGID | escape-chars` ;;
-esac
-
-cat <<EOF
-<tr>$begin $i $end
-<td class="msgid"><code>
-$msgid
-</code></td></tr>
-<tr><td>
-EOF
-
-case $modified in
-  no ) cat $3 ;;
-  * )
-    cat $2 | escape-chars | @WDIFF@ \
-      --start-delete "<span class=\"removed\"><del><strong>" \
-      --end-delete "</strong></del></span>" \
-      --start-insert "<span class=\"inserted\"><ins><em>" \
-      --end-insert "</em></ins></span>" - $3 
-    ;;
-esac | @SED@ 's/^[[:space:]]*$/\&nbsp;/;$! s,.*,&<br />,'
-
-echo "</td></tr>"
-
-echo $(($i + 1)) > $1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]