59 linhas
1.9 KiB
Bash
Arquivo executável
59 linhas
1.9 KiB
Bash
Arquivo executável
#!/bin/bash -e
|
|
# 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
|
|
# 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/>.
|
|
|
|
source "$(dirname "$0")/ths-variables"
|
|
source ".ths"
|
|
|
|
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
|
echo "Usage $(basename "$0") <messages-tree> <pot-tree>"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# -eq 2 ]; then
|
|
messages="$1"
|
|
pot="$2"
|
|
else
|
|
messages="trunk-kf6/$lcode/messages"
|
|
pot="trunk-kf6/templates/messages"
|
|
fi
|
|
|
|
wdir=$PWD
|
|
cd "$pot"
|
|
for dir in */; do
|
|
(
|
|
cd "$dir"
|
|
podir="$wdir/$messages/$dir"
|
|
if [ ! -e "$podir" ]; then
|
|
mkdir "$podir"
|
|
svn add "$podir"
|
|
fi
|
|
for file in $(find . -name '*.pot'); do
|
|
po=${file:0:-1}
|
|
if [ ! -e "$podir/$po" ]; then
|
|
echo -e "${RED}${dir}/${po}${ENDCOLOR}"
|
|
msginit -i "$file" -o "$podir/$po" --no-translator
|
|
cd "$podir"
|
|
svn add "$po"
|
|
cd "$wdir/$pot/$dir"
|
|
sed -ie 's/\"Plural-Forms: nplurals=3; plural=(n%10==1 \&\& n%100!=11 ? 0 : n%10>=2 \&\& (n"/"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10>=2 \&\& (n%100<10 || n"/
|
|
s/\"%100<10 || n%100>=20) ? 1 : 2);\\n\"/"%100>=20) ? 1 : n%10==0 || (n%100>10 \&\& n%100<20) ? 2 : 3);\\n"/
|
|
/\"Language: lt\\n\"/d' "$podir/$po"
|
|
rm "$podir/$po"e
|
|
fi
|
|
done
|
|
)
|
|
done
|