wesnoth-l10n-tools/update

53 lines
1.9 KiB
Plaintext
Raw Normal View History

2008-09-18 13:36:37 +01:00
#!/bin/bash
# Update translations from subversion repository and merge them
2020-12-29 19:44:53 +00:00
# Copyright (C) 2007-2008 Andrius Štikonas <andrius@stikonas.eu>
2008-09-18 13:36:37 +01:00
#
# 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/>.
2019-06-10 00:00:02 +01:00
source "$(dirname "$0")/variables"
2008-09-18 13:36:37 +01:00
2019-06-10 00:00:02 +01:00
echo -e "Language: $RED$LCODE$ENDCOLOR"
2008-09-18 13:36:37 +01:00
for BRANCH in $BRANCHES; do
2019-06-10 00:00:02 +01:00
echo -e "Checking out files from $BLUE$BRANCH$ENDCOLOR"
2013-03-28 11:23:11 +00:00
if [ ! -e "$BRANCH" ]; then
mkdir "$BRANCH"
2008-09-18 13:36:37 +01:00
fi
2019-06-10 00:00:02 +01:00
"$GIT" archive --remote "$REPO" --prefix="$BRANCH-temp/" --format=tar "$BRANCH:po" | tar x
for dir in $(ls "$BRANCH-temp/wesnoth"* -d); do
echo "Processing $(basename "$dir" | sed s/wesnoth-//).$LCODE.po"
file="$BRANCH/$(basename "$dir" | sed s/wesnoth-//).$LCODE.po"
if [ -f "$dir""/$LCODE"".po" ]; then
if [ -f "$file" ]; then
2019-06-10 00:00:02 +01:00
echo -e "${BLUE}Merging:$ENDCOLOR"
$MSGMERGE -U -v "$file" "$dir/$(basename "$dir").pot"
rm -f "$file~"
2008-09-18 13:36:37 +01:00
else
2019-06-10 00:00:02 +01:00
echo -e "${RED}Copying:$ENDCOLOR"
cp "$dir/$LCODE.po" "$file"
2008-09-18 13:36:37 +01:00
fi
else
2019-06-10 00:00:02 +01:00
if [ ! -f "$file" ]; then
echo -e "${RED}No po file in repository. Running msginit.$ENDCOLOR"
2008-09-18 13:36:37 +01:00
echo "$dir"
2019-06-10 00:00:02 +01:00
"$MSGINIT" -i "$dir/$(basename "$dir").pot" -o "$file"
2008-09-18 13:36:37 +01:00
else
2019-06-10 00:00:02 +01: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
2019-06-10 00:00:02 +01:00
echo -e "${GREEN}Finished.$ENDCOLOR"