wesnoth-l10n-tools/update

53 lines
1.8 KiB
Plaintext
Raw Normal View History

2008-09-18 13:36:37 +01:00
#!/bin/bash
# Update translations from subversion repository and merge them
# Copyright (C) 2007-2008 Andrius Štikonas <stikonas@gmail.com>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
2009-05-18 11:49:35 +01:00
source "`dirname $0`/variables"
2008-09-18 13:36:37 +01:00
2008-11-11 09:57:24 +00:00
echo -e "Language: $RED$LCODE"$ENDCOLOR
2008-09-18 13:36:37 +01:00
for BRANCH in $BRANCHES; do
2013-03-28 11:23:11 +00:00
echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
if [ ! -e "$BRANCH" ]; then
mkdir "$BRANCH"
2008-09-18 13:36:37 +01:00
fi
2013-03-28 11:23:11 +00:00
$GIT archive --remote $REPO --prefix="$BRANCH-temp/" --format=tar "$BRANCH:po" | tar x
for dir in `ls "$BRANCH-temp/wesnoth"* -d`; do
2009-05-21 14:14:19 +01:00
echo "Processing `basename $dir | sed s/wesnoth-//`.$LCODE.po"
2013-03-28 11:23:11 +00:00
file="$BRANCH/`basename $dir | sed s/wesnoth-//`.$LCODE.po"
2008-09-18 13:36:37 +01:00
if [ -f $dir"/"$LCODE".po" ]; then
if [ -f "$file" ]; then
2009-05-18 11:49:35 +01:00
echo -e $BLUE"Merging:"$ENDCOLOR
$MSGMERGE -U -v "$file" "$dir/`basename $dir`.pot"
2009-05-18 11:49:35 +01:00
rm -f $file~
2008-09-18 13:36:37 +01:00
else
2009-05-18 11:49:35 +01:00
echo -e $RED"Copying:"$ENDCOLOR
cp "$dir/$LCODE.po" "$file"
2008-09-18 13:36:37 +01:00
fi
else
if [ ! -f $file ]; then
2008-11-11 09:57:24 +00:00
echo -e $RED"No po file in repository. Running msginit."$ENDCOLOR
2008-09-18 13:36:37 +01:00
echo "$dir"
$MSGINIT -i "$dir/`basename $dir`.pot" -o $file
else
2008-11-11 09:57:24 +00:00
echo -e $RED"No po file in repository. Found file in workspace."$ENDCOLOR
2008-09-18 13:36:37 +01:00
fi
fi
echo ""
done
2013-03-28 11:23:11 +00:00
rm -rf "$BRANCH-temp"
2008-09-18 13:36:37 +01:00
done
2008-11-11 09:57:24 +00:00
echo -e $GREEN"Finished."$ENDCOLOR