Date: Sat, 03 May 2008 10:47:56 +0200 From: Gabor PALI <pgj@FreeBSD.org> To: doc@FreeBSD.org Subject: A Script for Translators: mfen Message-ID: <481C26BC.2090701@FreeBSD.org> In-Reply-To: <20080429225143.GA74318@dshield.infosecurityresearch.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Hello,
I wrote a small shell script to check which files should be merged from
English or to check incorrect revision references in the translations.
I found it very useful in my work, so I think it should be shared with
the members of the FreeBSD Documentation Project. I did not see anything
like this in the repositories, but you can throw me rocks if somebody
has already done this before :)
I generalized and prepared it a bit and it should work for any language
in the doc/www tree. The format of the output is tuned to be comfortable
for generating commit messages, however this feature should be enhanced
in the future. It contains a few "awk(1)ward" tricks, so your
suggestions and comments are more then welcome.
Best regards,
-pgj
[-- Attachment #2 --]
#!/bin/sh
# mfen
# Compare revisions of documentation of different languages.
# It is mainly used to check which files should be merged from
# or have incorrent revision information.
# Here is how to use this:
#
# $ mfen en_US.ISO8859-1 hu_HU.ISO8859-2
# Copyright 2008 The FreeBSD Hungarian Documentation Project
# Created by: PALI, Gabor <pgj@FreeBSD.org>
PATH=/bin:/usr/bin:/usr/sbin
CVS_ID_TAG=FreeBSD
traverse() {
for j in `ls $2`; do
if [ -d $2/$j ]; then
traverse $1/$j $2/$j $3$j/
else
TR=`grep Original\ Revision $2/$j`
if [ -n "$TR" ]; then
if [ -f "$1/$j" ]; then
LG=`grep "[$]$CVS_ID_TAG:" $1/$j`
if [ -n "$LG" ]; then
FROM=`echo $TR | awk '{print substr($0, index($0, "1.") + 2, 6)}' | awk '{print $1}'`
TO=`echo $LG | awk '{print substr($0, index($0, "1.") + 2, 6)}' | awk '{print $1}'`
if [ $FROM -lt $TO ]; then
printf "1.%-4d --> 1.%-4d %s\n" $FROM $TO $3$j
elif [ $FROM -gt $TO ]; then
printf "REVISION ERROR %s\n" $3$j
fi
fi
else
printf "NOT FOUND %s\n" $3$j
fi
fi
fi
done
}
if [ -n "$1" ] && [ -n "$2" ]; then
traverse $1 $2 ""
else
echo USAGE: $0 "directory1" "directory2"
fi
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?481C26BC.2090701>
