|
|
|
@ -17,36 +17,40 @@
|
|
|
|
|
|
|
|
|
|
source "$(dirname "$0")/variables" |
|
|
|
|
|
|
|
|
|
echo -e "Language: $RED$LCODE$ENDCOLOR" |
|
|
|
|
echo -e "Language: ${RED}${LCODE}${ENDCOLOR}" |
|
|
|
|
for BRANCH in $BRANCHES; do |
|
|
|
|
echo -e "Checking out files from $BLUE$BRANCH$ENDCOLOR" |
|
|
|
|
if [ ! -e "$BRANCH" ]; then |
|
|
|
|
mkdir "$BRANCH" |
|
|
|
|
fi |
|
|
|
|
"$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 |
|
|
|
|
echo -e "${BLUE}Merging:$ENDCOLOR" |
|
|
|
|
$MSGMERGE -U -v "$file" "$dir/$(basename "$dir").pot" |
|
|
|
|
rm -f "$file~" |
|
|
|
|
else |
|
|
|
|
echo -e "${RED}Copying:$ENDCOLOR" |
|
|
|
|
cp "$dir/$LCODE.po" "$file" |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
if [ ! -f "$file" ]; then |
|
|
|
|
echo -e "${RED}No po file in repository. Running msginit.$ENDCOLOR" |
|
|
|
|
echo "$dir" |
|
|
|
|
"$MSGINIT" -i "$dir/$(basename "$dir").pot" -o "$file" |
|
|
|
|
else |
|
|
|
|
echo -e "${RED}No po file in repository. Found file in workspace.$ENDCOLOR" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
echo "" |
|
|
|
|
done |
|
|
|
|
rm -rf "$BRANCH-temp" |
|
|
|
|
echo -e "Checking out files from ${BLUE}${BRANCH}${ENDCOLOR}" |
|
|
|
|
if [ ! -e "$BRANCH" ]; then |
|
|
|
|
CURRENT_DIR="$PWD" |
|
|
|
|
( |
|
|
|
|
cd $LOCAL_REPO |
|
|
|
|
git worktree add "${CURRENT_DIR}/${BRANCH}" "$BRANCH" |
|
|
|
|
) |
|
|
|
|
fi |
|
|
|
|
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 |
|
|
|
|
echo -e "$BLUE""Merging:$ENDCOLOR" |
|
|
|
|
msgmerge -U -v "$file" "${dir}/$(basename "$dir").pot" |
|
|
|
|
rm -f "$file~" |
|
|
|
|
else |
|
|
|
|
echo -e "${RED}Copying:${ENDCOLOR}" |
|
|
|
|
cp "${dir}/${LCODE}.po" "$file" |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
if [ ! -f "$file" ]; then |
|
|
|
|
echo -e "${RED}No po file in repository. Running msginit.${ENDCOLOR}" |
|
|
|
|
echo "$dir" |
|
|
|
|
msginit -i "$dir/$(basename "$dir").pot" -o "$file" |
|
|
|
|
else |
|
|
|
|
echo -e "${RED}No po file in repository. Found file in workspace.${ENDCOLOR}" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
echo "" |
|
|
|
|
done |
|
|
|
|
rm -rf "${BRANCH}-temp" |
|
|
|
|
done |
|
|
|
|
echo -e "${GREEN}Finished.$ENDCOLOR" |
|
|
|
|
echo -e "${GREEN}Finished.${ENDCOLOR}" |
|
|
|
|