|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# ***************************************************************************
|
|
|
|
# merge_po
|
|
|
|
# ++++++++++++++++++++
|
|
|
|
# copyright : (C) 2006
|
|
|
|
# Frank Schoolmeesters
|
|
|
|
# & the Krusader Krew
|
|
|
|
# e-mail : krusader@users.sourceforge.net
|
|
|
|
# web site : http://www.krusader.org
|
|
|
|
# description : update translated docbook files
|
|
|
|
#
|
|
|
|
# ***************************************************************************
|
|
|
|
# * Permission is granted to copy, distribute and/or modify this *
|
|
|
|
# * document under the terms of the GNU Free Documentation License, *
|
|
|
|
# * Version 1.1 or any later version published by the Free Software *
|
|
|
|
# * Foundation; with no Invariant Sections, no Front-Cover Texts and *
|
|
|
|
# * no Back-Cover Texts. A copy of the license is available on the *
|
|
|
|
# * GNU site http://www.gnu.org/licenses/fdl.html or by writing to: *
|
|
|
|
# * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
|
|
|
|
# * MA 02111-1307, USA. *
|
|
|
|
# ***************************************************************************
|
|
|
|
#
|
|
|
|
# This script merges po files with the latest version of the english pot files in the language folder ../doc/i18n/$lang
|
|
|
|
# with po2xml *.docbook.po > *.docbook
|
|
|
|
# Use this script to created the latest version for the po files
|
|
|
|
|
|
|
|
|
|
|
|
# Requirements: bash, ./update_pot, msgmerge, msgfmt
|
|
|
|
# usage: run ./merge_po ru
|
|
|
|
|
|
|
|
|
|
|
|
# --help
|
|
|
|
if test $# -eq 0 || test "$1" = "--help" ; then
|
|
|
|
echo "update_po <lang_subdir>"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create the latest pot templates
|
|
|
|
./update_pot
|
|
|
|
|
|
|
|
# read first parameter
|
|
|
|
lang=$1
|
|
|
|
|
|
|
|
# jump into the lang folder
|
|
|
|
cd ../doc/i18n/$lang
|
|
|
|
|
|
|
|
# merge po files with the updated english pot files
|
|
|
|
for FILENAME in $(ls *.po);do
|
|
|
|
# display the '*.po' filename
|
|
|
|
echo merging ${FILENAME} ...
|
|
|
|
FILENAME=`echo ${FILENAME} | perl -p -i -e 's/.po/''/g'`
|
|
|
|
# make backup copy of the *.po files
|
|
|
|
cp $FILENAME.po $FILENAME.po.bak
|
|
|
|
# merge po files with the updated english pot files
|
|
|
|
msgmerge $FILENAME.po ../pot/${FILENAME}.pot -q --force-po --output-file=${FILENAME}.po.new
|
|
|
|
# rename po.new into po
|
|
|
|
mv $FILENAME.po.new $FILENAME.po
|
|
|
|
# show translation statistics
|
|
|
|
msgfmt $FILENAME.po --statistics -c -v --output-file=$FILENAME.tmp
|
|
|
|
echo ""
|
|
|
|
# delete temporary files 'foo.po.tmp'
|
|
|
|
rm -f $FILENAME.tmp
|
|
|
|
done
|
|
|
|
|
|
|
|
echo NOTE: This script sould only be used by the Documentation i18n coordinator or the Krusader Krew
|
|
|
|
echo Please contact the Documentation i18n coordinator if you want to translate the Krusader documentation
|
|
|
|
echo Wrong usage of this script might result in outdated documentation files
|