123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- #!/bin/bash
- echo "$(tput setaf 2)lang-import.sh started$(tput sgr 0)" >&2
- LNG=$1
- if [ -z "$LNG" ]; then
- LNG=all;
- if [ -z "$CONFIG_OK" ]; then eval "$(cat config.sh)"; fi
- if [ -z "$CONFIG_OK" ] | [ $CONFIG_OK -eq 0 ]; then echo "$(tput setaf 1)Config NG!$(tput sgr 0)" >&2; exit 1; fi
- fi
- if [[ ! -z "$COMMUNITY_LANGUAGES" && "$LNG" = "all" ]]; then
- LANGUAGES+=" $COMMUNITY_LANGUAGES"
- else
- LANGUAGES="$LNG"
- fi
- echo "$(tput setaf 2)lang-import languages:$LANGUAGES$(tput sgr 0)" >&2
- 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 "$(tput setaf 1)Input file $LNGISO.po not found!$(tput sgr 0)" >&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/\xc3\x81/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8c/C/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8d/c/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8e/D/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8f/d/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x89/E/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x9a/E/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x9b/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x8d/I/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x87/N/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x88/n/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x93/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb3/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x98/R/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x99/r/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa0/S/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa1/s/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa4/T/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa5/t/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9a/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xba/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xae/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xaf/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9d/Y/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbd/y/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xbd/Z/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xbe/z/g' $LNG'_filtered.po'
- fi
- if [[ "$LNG" = "de" || "$LNG" = "sv" ]]; then
-
- sed -i 's/\xc3\xa4/\\xe1/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x84/\\xe1/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbc/\\xf5/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9c/\\xf5/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb6/\\xef/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x96/\\xef/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9f/\\xe2/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 [ "$LNG" = "sv" ]; then
- sed -i 's/\xc3\x85/A/g' $LNG'_filtered.po'
- sed -i 's/\xc3\xA5/a/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "no" ]; then
-
-
- sed -i 's/\xc3\x86/\\xe1/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa6/\\xe1/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x98/\\xef/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb8/\\xef/g' $LNG'_filtered.po'
-
-
- sed -i 's/\xc3\x85/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa5/a/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\xaa/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb3/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb2/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb4/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb9/u/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "da" ]; then
- sed -i 's/\xc3\x85/Aa/g' $LNG'_filtered.po'
- sed -i 's/\xc3\xA5/aa/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "sl" ]; then
-
- sed -i 's/\xc3\xab/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "hu" ]; then
-
- sed -i 's/\xc3\x81/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x89/E/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x8d/I/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x93/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb3/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x96/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb6/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x90/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x91/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9a/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xba/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9c/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbc/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xb0/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xb1/u/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "lb" ]; then
-
- sed -i 's/\xc3\xab/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "hr" ]; then
-
- sed -i 's/\xc3\xab/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "lt" ]; then
-
- sed -i 's/\xc3\xab/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
- fi
- if [ "$LNG" = "sk" ]; then
-
- sed -i 's/\xc3\x81/A/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa1/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa4/a/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8c/C/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8d/c/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8e/D/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\x8f/d/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x89/E/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xa9/e/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x8d/I/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xad/i/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\xbe/l/g' $LNG'_filtered.po'
-
- sed -i 's/\xc4\xbd/L/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x87/N/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x88/n/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x93/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb3/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xb4/o/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x94/O/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x95/r/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\x94/R/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa0/S/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa1/s/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa4/T/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xa5/t/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9a/U/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xba/u/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\x9d/Y/g' $LNG'_filtered.po'
-
- sed -i 's/\xc3\xbd/y/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xbd/Z/g' $LNG'_filtered.po'
-
- sed -i 's/\xc5\xbe/z/g' $LNG'_filtered.po'
- fi
-
- sed -i 's/\xce\xbc/\\xe4/g' $LNG'_filtered.po'
- sed -i 's/\xc2\xa0/ /g' $LNG'_filtered.po'
- if grep --color='auto' -P -n '[^\x00-\x7F]' $LNG'_filtered.po' >nonascii.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=$(tput setaf 2)$LNGISO$(tput sgr 0)" >&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 -ne " processing $num of $CNTTXT\033[0K\r" >&2
- echo '"\x00"'
- num=$((num+1))
- else
- echo -ne " processing $num of $CNTTXT\033[0K\r" >&2
- echo "$s2"
- num=$((num+1))
- fi
- fi
- done > lang_en_$LNG.txt
- echo >&2
- echo "$(tput setaf 2)Finished with $LNGISO$(tput sgr 0)" >&2
- sed -i 's/""/"\\x00"/g' lang_en_$LNG.txt
- sed -i "s/\r//g" lang_en_$LNG.txt
- python3 ../../lang-check.py $LNG --warn-empty
- python3 ../../lang-check.py $LNG --information >$LNG-output.txt
- echo >&2
- echo "$(tput setaf 2)lang-import.sh finished$(tput sgr 0)">&2
|