123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- #!/bin/bash
- if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
- if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo 'Config NG!' >&2; exit 1; fi
- if [ ! -z "$COMMUNITY_LANGUAGES" ]; then
- LANGUAGES+=" $COMMUNITY_LANGUAGES"
- fi
- echo "lang-import languages:$LANGUAGES" >&2
- LNG=$1
- if [ -z "$LNG" ]; then LNG=all; fi
- if [ "$LNG" = "all" ]; then
- for lang in $LANGUAGES; do
- ./lang-import.sh $lang
- done
-
-
-
-
-
-
-
-
-
-
-
-
- exit 0
- fi
- LNGISO=$LNG
- if [ "$LNG" = "cz" ]; then LNGISO=cs; fi
- cd po/new
- if ! [ -e $LNGISO.po ]; then
- echo "Input file $LNGISO.po not found!" >&2
- exit -1
- fi
- cat $LNGISO.po | sed 's/\\e/\\x1b/g;s/\\\\/\\/g' > $LNG'_filtered.po'
- sed -i 's/ \\n/ /g;s/\\n/ /g' $LNG'_filtered.po'
- if [ "$LNG" = "cz" ]; then
-
- sed -i 's/\xc5\xbe/z/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x9b/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x99/r/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8d/c/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "de" ]; then
-
- sed -i 's/\xc3\xa4/ae/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x84/Ae/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbc/ue/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9c/Ue/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb6/oe/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x96/Oe/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9f/ss/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "es" ]; then
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc2\xbf/?/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb3/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc2\xa1/!/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb1/n/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "fr" ]; then
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x81/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa0/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x80/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x89/E/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa8/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x88/E/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "it" ]; then
-
- sed -i 's/\xc3\xa8/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa0/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb2/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb9/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x88/E/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "nl" ]; then
-
- sed -i 's/\xc3\xab/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xaf/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa8/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb6/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xaa/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbc/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa7/c/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa0/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbc/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xae/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb4/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xba/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb1/n/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa2/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x85/A/g' $LNG'_filtered.po'
- fi
- if grep --color='auto' -P -n '[^\x00-\x7F]' $LNG'_filtered.po' >nonasci.txt; then
- exit
- fi
- cat $LNG'_filtered.po' | sed ':a;N;$!ba;s/\x22\n\x22//g' > $LNG'_new.po'
- CNTTXT=$(grep '^# MSG' -c $LNGISO.po)
- num=1
- echo " selected language=$LNGISO" >&2
- cat ../../lang_en.txt | sed 's/\\/\\\\/g' | while read -r s; do
- /bin/echo -e "$s"
-
- if [ "${s:0:1}" = "\"" ]; then
-
- s=$(/bin/echo -e "$s")
- s2=$(grep -F -A1 -B0 "msgid $s" "$LNG"_new.po | tail -n1 | sed 's/^msgstr //')
- if [ -z "$s2" ]; then
- echo " processing $num of $CNTTXT" >&2
- echo '"\x00"'
- num=$((num+1))
- else
- echo " processing $num of $CNTTXT" >&2
- echo "$s2"
- num=$((num+1))
- fi
- fi
- done > lang_en_$LNG.txt
- echo "Finished with $LNGISO" >&2
- sed -i 's/""/"\\x00"/g' lang_en_$LNG.txt
- sed -i "s/\r//g" lang_en_$LNG.txt
|