Adapt to KF5

This commit is contained in:
Andrius Štikonas 2014-11-21 23:12:46 +02:00
parent be18e73af2
commit a6add14fdc
12 changed files with 77 additions and 283 deletions

View File

@ -20,17 +20,6 @@
source "`dirname $0`/ths-variables"
if [ ! $MSGINIT ]; then
echo -e $RED"This program needs the msginit utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
function usage() {
echo "Usage `basename $0` [options] <translation-files> <template-files>"
echo
@ -123,9 +112,9 @@ else
echo
else
if [ ! $option_verbose ]; then
$MSGINIT $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename 2>&1 | egrep -v "^Created"
msginit $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename 2>&1 | egrep -v "^Created"
else
$MSGINIT $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename
msginit $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename
fi
fi
@ -136,5 +125,5 @@ echo "** Updating files against templates (optionally with compendium)... **"
for po in `cd $new ; find . -name "*.po" | sort`
do
[ $option_verbose ] && echo -n $new/$po
$MSGMERGE $option_verbose_msgmerge $option_no_fuzzy_matching $option_no_wrap $option_use_own_compendium --backup=off --update $new/$po $templates/${po}t
msgmerge $option_verbose_msgmerge $option_no_fuzzy_matching $option_no_wrap $option_use_own_compendium --backup=off --update $new/$po $templates/${po}t
done

View File

@ -14,10 +14,10 @@ function jobidfromstring()
}
echo -e $BLUE"Running poupdate..."$ENDCOLOR
./poupdate -NS --silent trunk stable pot-stable &
./poupdate -NS --silent trunk-kf5/$lcode/messages stable-kf5/$lcode/messages stable-kf5/templates/messages &
LASTJOB=`jobidfromstring $(jobs %%)`
JOBLIST="$LASTJOB"
./poupdate -NS --silent doc-trunk doc-stable doc-pot-stable &
./poupdate -NS --silent trunk-kf5/$lcode/docmessages stable-kf5/$lcode/docmessages stable-kf5/templates/docmessages &
LASTJOB=`jobidfromstring $(jobs %%)`
JOBLIST="$JOBLIST $LASTJOB"
@ -25,5 +25,5 @@ for JOB in $JOBLIST ; do
wait %$JOB
done
echo -e $BLUE"Removing obsolete entries..."$ENDCOLOR
./obsolete stable
./obsolete doc-stable
./obsolete stable-kf5/$lcode/messages
./obsolete stable-kf5/$lcode/docmessages

180
checkout
View File

@ -16,159 +16,49 @@
source "`dirname $0`/ths-variables"
if [ ! -f $THS ]; then
echo "Please enter your language code (Default: lt):"
read lcode
if [ ! "$lcode" ]; then
lcode="lt"
fi
echo lcode="$lcode" >> $THS
echo "Enter path for stable templates (Default: `pwd`/pot-stable/):"
read potstable
if [ ! "$potstable" ]; then
potstable="pot-stable/"
fi
echo potstable="$potstable" >> $THS
echo "Enter path for trunk templates (Default: `pwd`/pot-trunk/):"
read pottrunk
if [ ! "$pottrunk" ]; then
pottrunk="pot-trunk/"
fi
echo pottrunk="$pottrunk" >> $THS
echo "Enter path for stable messages (Default: `pwd`/stable/):"
read postable
if [ ! "$postable" ]; then
postable="stable/"
fi
echo postable="$postable" >> $THS
echo "Enter path for trunk messages (Default: `pwd`/pot-trunk/):"
read potrunk
if [ ! "$potrunk" ]; then
potrunk="trunk/"
fi
echo potrunk="$potrunk" >> $THS
while [ ! "$documentation" = "n" ] && [ ! "$documentation" = "y" ]; do
echo "Do you want to checkout documentation messages and templates? [y/N]"
read documentation
documentation=`echo $documentation | tr YN yn`
if [ ! $documentation ]; then
documentation="n"
fi
done
echo documentation="$documentation" >> $THS
if [ "$documentation" = "y" ]; then
echo "Enter path for documentation stable templates (Default: `pwd`/doc-pot-stable/):"
read docpotstable
if [ ! "$docpotstable" ]; then
docpotstable="doc-pot-stable/"
fi
echo docpotstable="$docpotstable" >> $THS
echo "Enter path for documentation trunk templates (Default: `pwd`/doc-pot-trunk/):"
read docpottrunk
if [ ! "$docpottrunk" ]; then
docpottrunk="doc-pot-trunk/"
fi
echo docpottrunk="$docpottrunk" >> $THS
echo "Enter path for documentation stable messages (Default: `pwd`/doc-stable/):"
read docstable
if [ ! "$docstable" ]; then
docstable="doc-stable/"
fi
echo docstable="$docstable" >> $THS
echo "Enter path for documentation trunk messages (Default: `pwd`/doc-trunk/):"
read doctrunk
if [ ! "$doctrunk" ]; then
doctrunk="doc-trunk/"
fi
echo doctrunk="$doctrunk" >> $THS
if [ ! -f ".ths" ]; then
echo "Please enter your language code (Default: lt):"
read lcode
if [ ! "$lcode" ]; then
lcode="lt"
fi
echo lcode="$lcode" >> ".ths"
while [ ! "$svnwrite" = "n" ] && [ ! "$svnwrite" = "y" ]; do
echo "Do you have write access to KDE svn repository? [y/N]"
read svnwrite
svnwrite=`echo $svnwrite | tr YN yn`
if [ ! $svnwrite ]; then
svnwrite="n"
fi
echo "Do you have write access to KDE svn repository? [y/N]"
read svnwrite
svnwrite=`echo $svnwrite | tr YN yn`
if [ ! $svnwrite ]; then
svnwrite="n"
fi
done
echo svnwrite="$svnwrite" >> $THS
if [ "$svnwrite" = "y" ]; then
while [ ! "$username" ]; do
echo "Please enter your username for KDE svn repository:"
read username
done
echo username="$username" >> $THS
fi
echo svnwrite="$svnwrite" >> ".ths"
# Checkout repositories.
mkdir trunk-kf5 stable-kf5
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/branches/stable/l10n-kde4/templates/messages $potstable
cd trunk-kf5
svn co svn+ssh://svn@svn.kde.org/home/kde/trunk/l10n-kf5/templates
svn co svn+ssh://svn@svn.kde.org/home/kde/trunk/l10n-kf5/scripts
svn co svn+ssh://svn@svn.kde.org/home/kde/trunk/l10n-kf5/$lcode
cd ../stable-kf5
svn co svn+ssh://svn@svn.kde.org/home/kde/branches/stable/l10n-kf5/templates
svn co svn+ssh://svn@svn.kde.org/home/kde/branches/stable/l10n-kf5/scripts
svn co svn+ssh://svn@svn.kde.org/home/kde/branches/stable/l10n-kf5/$lcode
else
$SVN co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kde4/templates/messages $potstable
svn co svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/templates
svn co svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/scripts
svn co svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/$lcode
svn co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kf5/templates
svn co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kf5/scripts
svn co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kf5/$lcode
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/trunk/l10n-kde4/templates/messages $pottrunk
else
$SVN co svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/templates/messages $pottrunk
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/branches/stable/l10n-kde4/$lcode/messages $postable
else
$SVN co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kde4/$lcode/messages $postable
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/trunk/l10n-kde4/$lcode/messages $potrunk
else
$SVN co svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/$lcode/messages $potrunk
fi
if [ "$documentation" = "y" ]; then
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/branches/stable/l10n-kde4/templates/docmessages $docpotstable
else
$SVN co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kde4/templates/docmessages $docpotstable
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/trunk/l10n-kde4/templates/docmessages $docpottrunk
else
$SVN co svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/templates/docmessages $docpottrunk
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/branches/stable/l10n-kde4/$lcode/docmessages $docstable
else
$SVN co svn://anonsvn.kde.org/home/kde/branches/stable/l10n-kde4/$lcode/docmessages $docstable
fi
if [ "$svnwrite" = "y" ]; then
$SVN co svn+ssh://$username@svn.kde.org/home/kde/trunk/l10n-kde4/$lcode/docmessages $doctrunk
else
$SVN co svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/$lcode/docmessages $doctrunk
fi
fi
else
source $THS
$SVN up all-trunk/$lcode
$SVN up all-stable/$lcode
$SVN up all-trunk/templates
$SVN up all-stable/templates
$SVN up all-trunk/scripts
$SVN up all-trunk/templates
$SVN up all-stable/scripts
$SVN up all-stable/templates
source ".ths"
svn up trunk-kf5/templates
svn up trunk-kf5/$lcode
svn up trunk-kf5/scripts
svn up stable-kf5/templates
svn up stable-kf5/$lcode
svn up stable-kf5/scripts
fi

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
source "`dirname $0`/ths-variables"
source $THS
source ".ths"
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo "Usage `basename $0` <messages-tree> <pot-tree>"
@ -26,8 +26,8 @@ if [ $# -eq 2 ]; then
messages="$1"
pot="$2"
else
messages="$potrunk"
pot="$pottrunk"
messages="trunk-kf5/$lcode/messages"
pot="trunk-kf5/templates"
fi
wdir="`pwd`"

View File

@ -18,17 +18,12 @@
# # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# obsolete - remove obsolete gettext entries
source "`dirname $0`/ths-variables"
source ".ths"
if [ $# -eq 1 ]; then
folder="$1"
else
folder="trunk"
folder="trunk-kf5/$lcode/messages"
fi
# posieve remove-obsolete $folder
for po in `find -L "$folder" -name "*.po"`; do
msgattrib --no-obsolete "$po" > "$po".temp
mv "$po".temp "$po"
done
posieve remove-obsolete $folder

View File

@ -14,12 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
source "`dirname $0`/ths-variables"
source "$THS"
source ".ths"
tar cfvj trunk.tar.bz2 `svn status $potrunk | awk '{print $2}'`
tar cfvj stable.tar.bz2 `svn status $postable | awk '{print $2}'`
if [ "$documentation" = "y" ]; then
tar cfvj doc-trunk.tar.bz2 `svn status $doctrunk | awk '{print $2}'`
tar cfvj doc-stable.tar.bz2 `svn status $docstable | awk '{print $2}'`
fi
tar cfvj trunk.tar.bz2 `svn status trunk-kf5/$lcode | awk '{print $2}'`
tar cfvj stable.tar.bz2 `svn status trunk-kf5/$lcode | awk '{print $2}'`

View File

@ -19,18 +19,6 @@
# ths-pocompare.sh - compare two translation files using diff, unwrapps first
# for best comparison.
source "`dirname $0`/ths-variables"
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $DIFF ]; then
echo -e $RED"This program needs the diff utility."$ENDCOLOR
exit 1
fi
if [ $# -ne 2 ]; then
echo "Usage `basename $0` <file1> <file2>"
exit 1
@ -39,7 +27,7 @@ fi
file1=$1
file2=$2
$MSGMERGE --no-wrap $file1 $file1 -o ${file1}.for.diff
$MSGMERGE --no-wrap $file2 $file2 -o ${file2}.for.diff
$DIFF ${file1}.for.diff ${file2}.for.diff
msgmerge --no-wrap $file1 $file1 -o ${file1}.for.diff
msgmerge --no-wrap $file2 $file2 -o ${file2}.for.diff
diff ${file1}.for.diff ${file2}.for.diff
rm ${file1}.for.diff ${file2}.for.diff

View File

@ -19,18 +19,6 @@
# ths-pocompare-kdiff3.sh - compare two translation files using kdiff3,
# unwrapps first for best comparison.
source "`dirname $0`/ths-variables"
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $KDIFF3 ]; then
echo -e $RED"This program needs the kdiff3 utility."$ENDCOLOR
exit 1
fi
if [ $# -ne 2 ]; then
echo "Usage `basename $0` <file1> <file2>"
exit 1
@ -39,7 +27,7 @@ fi
file1=$1
file2=$2
$MSGMERGE --no-wrap $file1 $file1 -o ${file1}.for.diff
$MSGMERGE --no-wrap $file2 $file2 -o ${file2}.for.diff
$KDIFF3 ${file1}.for.diff ${file2}.for.diff
msgmerge --no-wrap $file1 $file1 -o ${file1}.for.diff
msgmerge --no-wrap $file2 $file2 -o ${file2}.for.diff
kdiff3 ${file1}.for.diff ${file2}.for.diff
rm ${file1}.for.diff ${file2}.for.diff

16
potopot
View File

@ -19,18 +19,6 @@
# ths-potopot.sh - converts po files to pot (template) files (basically
# strips all the translation).
source "`dirname $0`/ths-variables"
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGFILTER ]; then
echo -e $RED"This program needs the msgfilter utility."$ENDCOLOR
exit 1
fi
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` </directory/with/pofiles/>"
exit 1
@ -52,10 +40,10 @@ for file in `cd $pofiles; find . -name "*.po"`
do
echo -n "Working on ${file}. Unwrapping..."
# unwrap messages for cleaner operation
$MSGMERGE --no-wrap ${pofiles}/$file $pofiles/$file -o $pofiles/$file
msgmerge --no-wrap ${pofiles}/$file $pofiles/$file -o $pofiles/$file
# remove the translations and creating pot files
echo "Cleaning up translations..."
$MSGFILTER --input=$pofiles/$file --output-file=$pofiles/templates/${file}t --keep-header sed --expression='s/.*//' ; echo "done."
msgfilter --input=$pofiles/$file --output-file=$pofiles/templates/${file}t --keep-header sed --expression='s/.*//' ; echo "done."
# applying some more filters via sed: remove remaining \n signs (sed 1 and 2), removing the fuzzy headers (3), removing the empty "" (4), removing the extra empty lines (5)
echo "Applying additional filter..."
cat $pofiles/templates/${file}t | sed -e 's/msgstr \"\\n\"/msgstr \"\"/' | \

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# Copyright 2007, Donatas Glodenis <dgvirtual@akl.lt>
# Copyright 2009, Andrius Štikonas <stikonas@gmail.com>
# Copyright 2009, Andrius Štikonas <andrius@stikonas.eu>
#
# #
# # This script is free software; you can redistribute it and/or modify
@ -24,19 +24,6 @@
source "`dirname $0`/ths-variables"
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $DIFF ]; then
echo -e $RED"This program suggests the diff utility."$ENDCOLOR
fi
if [ ! $SVN ]; then
echo -e $RED"This program suggests the svn utility."$ENDCOLOR
fi
## Declaring Functions
function usage() {
echo "Usage `basename $0` [options] <updated-file-dir> <translations-file-tree> <translations-template-tree>"
@ -152,8 +139,8 @@ if [ `cd "$tra_tree"; find ${updfile} 2> /dev/null | wc -l` -lt 1 ]; then
tplfile=`cd "$tpl_tree"; find ${updfile}t`
secdir=`dirname "$tplfile"`
cp "$upd_dir/$updfile" "$tra_tree/$updfile"
if [ $SVN ]; then
$SVN add "$tra_tree/$updfile"
if [ svn ]; then
svn add "$tra_tree/$updfile"
fi
fi
@ -166,25 +153,25 @@ if [ ! "$option_new_as_secondary" = "Y" ]; then
if [ "$option_verbose" = "Y" ]; then
echo
echo "UPDATING $trafile using translations from $upd_dir/$updfile as SECONDARY translations"
$MSGMERGE -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile
msgmerge -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile
else
$MSGMERGE -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile 2> /dev/null
msgmerge -N -v --compendium=$upd_dir/$updfile -o $tra_tree/${trafile}.new $tra_tree/${trafile}.old $tpl_tree/$tplfile 2> /dev/null
fi
else
if [ "$option_verbose" = "Y" ]; then
echo
echo "UPDATING $trafile using translations from $upd_dir/$updfile as PRIMARY translations"
$MSGMERGE -N -v --compendium=$tra_tree/${trafile}.old -o $tra_tree/${trafile}.new $upd_dir/$updfile $tpl_tree/$tplfile
msgmerge -N -v --compendium=$tra_tree/${trafile}.old -o $tra_tree/${trafile}.new $upd_dir/$updfile $tpl_tree/$tplfile
else
$MSGMERGE -N -v --compendium=$tra_tree/${trafile}.old -o $tra_tree/${trafile}.new $upd_dir/$updfile $tpl_tree/$tplfile 2> /dev/null
msgmerge -N -v --compendium=$tra_tree/${trafile}.old -o $tra_tree/${trafile}.new $upd_dir/$updfile $tpl_tree/$tplfile 2> /dev/null
fi
fi
# delete the Rosetta/Launchpad headers, only needed if the file was imported from Rosetta
cat $tra_tree/${trafile}.new | sed '/X-Rosetta-Export-Date/d' > $tra_tree/$trafile
if [ $DIFF ]; then
if [ "`$DIFF $tra_tree/${trafile}.old $tra_tree/${trafile}.new`" ]; then
if [ $diff ]; then
if [ "`$diff $tra_tree/${trafile}.old $tra_tree/${trafile}.new`" ]; then
changed_files=$(($changed_files+1))
fi
fi
@ -194,7 +181,7 @@ rm $tra_tree/${trafile}.old $tra_tree/${trafile}.new
processed_files=$(($processed_files+1))
if [ ! "$option_verbose" = "Y" ] && [ ! "$option_silent" = "Y" ]; then
echo -ne "\r$processed_files/$total_files processed"
if [ $DIFF ] && [ ! $changed_files -eq 0 ]; then
if [ $diff ] && [ ! $changed_files -eq 0 ]; then
echo -ne ", $changed_files changed"
fi
if [ ! $skipped_files -eq 0 ]; then
@ -205,7 +192,7 @@ fi
done
echo -ne $BLUE"\r$processed_files/$total_files processed"$ENDCOLOR
if [ $DIFF ] && [ ! $changed_files -eq 0 ]; then
if [ $diff ] && [ ! $changed_files -eq 0 ]; then
echo -ne $BLUE", $changed_files changed"$ENDCOLOR
fi

View File

@ -18,18 +18,6 @@
#
# ths-stripfuzzy.sh - makes all fuzzy strings non-fuzzy in a translation project.
source "`dirname $0`/ths-variables"
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGATTRIB ]; then
echo -e $RED"This program needs the msgattrib utility."$ENDCOLOR
exit 1
fi
if [ $# -ne 2 ]; then
echo "Usage `basename $0` <pofile directory> <templates directory>"
exit 1
@ -42,7 +30,7 @@ echo "Completely removing the fuzzy strings from the pofiles..."
for po in `cd $pofiles ; find . -name "*.po"`
do
echo -n $pofiles/$po
$MSGATTRIB -o $pofiles/$po --no-fuzzy $pofiles/$po
msgattrib -o $pofiles/$po --no-fuzzy $pofiles/$po
done
@ -50,5 +38,5 @@ echo "Restoring the previously fuzzy as untranslated strings..."
for po in `cd $pofiles ; find . -name "*.po"`
do
echo -n $pofiles/$po
$MSGMERGE --no-fuzzy-matching --backup=off --update $pofiles/$po $templates/${po}t
msgmerge --no-fuzzy-matching --backup=off --update $pofiles/$po $templates/${po}t
done

24
ths-variables Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/bin/bash
# You would probably need to make some adjustments to variables.
# Copyright (C) 2009 Andrius Štikonas <stikonas@gmail.com>
# Copyright (C) 2009 Andrius Štikonas <andrius@stikonas.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -15,21 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Settings file
THS=".ths"
# Binaries
SVN=`which svn 2> /dev/null`
DIFF=`which diff 2> /dev/null`
MSGATTRIB=`which msgattrib 2> /dev/null`
MSGFILTER=`which msgfilter 2> /dev/null`
MSGFMT=`which msgfmt 2> /dev/null`
MSGINIT=`which msginit 2> /dev/null`
MSGMERGE=`which msgmerge 2> /dev/null`
KDIFF3=`which kdiff3 2> /dev/null`
# Colors
RED="\033[1;31m"
GREEN="\033[1;32m"
BLUE="\033[1;34m"
ENDCOLOR="\033[0m"
RED="\e[1;31m"
GREEN="\e[1;32m"
BLUE="\e[1;34m"
ENDCOLOR="\e[0m"