Xfce Wiki

Sub domains
 
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


translations:review-po-file [2011/07/25 22:31] (current) – created mike
Line 1: Line 1:
 +====== Review PO file ======
 +
 +As a reviewer, tools to help you doing the job aren't very present, and the current Transifex installation doesn't ease the task either.
 +
 +When someone sends you a newly translated PO file and you want to check the differences you will need a tool to show you only the changed messages. Hereby you will find a quick-n-dirty shell script that uses basic commands.
 +
 +===== The script =====
 +
 +<code bash>
 +#!/bin/sh
 +PO_ORIG=$1
 +PO_REVIEW=$2
 +PO_TEMPL=$3
 +
 +MSGMERGE=msgmerge
 +DIFF=diff
 +PAGER=more
 +RM=/bin/rm
 +MKTEMP=mktemp
 +
 +# Usage
 +if test "$1" = "" -o "$2" = "" -o "$3" = ""; then
 +    echo Usage: $0 orig.po review.po template.pot
 +    exit 1
 +fi
 +
 +# Merge
 +TMP_ORIG=`$MKTEMP po-orig.XXX`
 +TMP_REVIEW=`$MKTEMP po-review.XXX`
 +$MSGMERGE $PO_ORIG $PO_TEMPL > $TMP_ORIG 2> /dev/null
 +$MSGMERGE $PO_REVIEW $PO_TEMPL > $TMP_REVIEW 2> /dev/null
 +
 +# Diff
 +$DIFF -u $TMP_ORIG $TMP_REVIEW | $PAGER
 +
 +# Clean up files
 +$RM $TMP_ORIG $TMP_REVIEW
 +</code>
 +
 +===== Example =====
 +
 +  $ cd xfce4-settings/po
 +  $ msgdiff.sh
 +  Usage: msgdiff.sh orig.po review.po template.pot
 +  $ msgdiff.sh fr.po 127.fr.po xfce4-settings.pot
 +  [...]
 +  @@ -899,15 +899,15 @@
 +  
 +   #. pixel value for some of the scales in the dialog
 +   #: ../dialogs/mouse-settings/main.c:142
 +  -#, c-format
 +  +#, fuzzy, c-format
 +   msgid "%g px"
 +  -msgstr ""
 +  +msgstr "%g px"
 +  
 +   #. miliseconds value for some of the scales in the dialog
 +   #: ../dialogs/mouse-settings/main.c:152
 +  -#, c-format
 +  +#, fuzzy, c-format
 +   msgid "%g ms"
 +  -msgstr ""
 +  +msgstr "%g ms"
 +  [...]
 +
 +===== Other resources =====
 +
 +There exist other scripts to use for doing the review job of course, you will find them bellow.
 +
 +  * https://edge.launchpad.net/pyg3t -- CLI tool podiff
 +  * http://pypi.python.org/pypi/polib/ -- Python library to manipulate PO files