ths-scripts/init-po-files

59 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/bash -e
2014-03-23 17:56:13 +00:00
# Copyright (C) 2009 Andrius Štikonas <andrius@stikonas.eu>
2009-03-23 20:41:53 +00: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/>.
source "$(dirname "$0")/ths-variables"
2014-11-21 21:12:46 +00:00
source ".ths"
2009-03-23 20:41:53 +00:00
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo "Usage $(basename "$0") <messages-tree> <pot-tree>"
2009-03-23 20:41:53 +00:00
exit 1
fi
if [ $# -eq 2 ]; then
messages="$1"
pot="$2"
2009-03-23 20:41:53 +00:00
else
2024-01-18 23:37:49 +00:00
messages="trunk-kf6/$lcode/messages"
pot="trunk-kf6/templates/messages"
2009-03-23 20:41:53 +00:00
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
2023-02-25 16:09:35 +00:00
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"/
2011-11-11 15:54:15 +00:00
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
)
2009-03-23 20:41:53 +00:00
done