File indexing completed on 2024-05-12 16:24:53

0001 EXPORTS_POT_DIR=1
0002 FILE_PREFIX=kdeconnect-android-store
0003 
0004 function export_pot_dir # First parameter will be the path of the directory where we have to store the pot files
0005 {
0006     potdir=$1
0007     txt2po --no-segmentation --progress=names -P -i ./metadata/android/en-US/short_description.txt -o $potdir/kdeconnect-android-store-short.pot
0008     txt2po --no-segmentation --progress=names -P -i ./metadata/android/en-US/full_description.txt -o $potdir/kdeconnect-android-store-full.pot
0009 }
0010 
0011 function import_po_dirs # First parameter will be a path that will be a directory to the dirs for each lang and then all the .po files inside
0012 {
0013     podir=$1
0014     # Some languages don't exist in Google Play or have different codes
0015     declare -a to_delete=( "bs" "ca@valencia" "sr@ijekavian" "sr@ijekavianlatin" "sr@latin" "ia" "eo" "tg" )
0016     for lang in "${to_delete[@]}"; do
0017         if [ -d $podir/$lang ]; then
0018             rm $podir/$lang/*
0019             rmdir $podir/$lang
0020         fi
0021     done
0022     declare -A to_rename=( ["az"]="az-AZ" ["cs"]="cs-CZ" ["da"]="da-DK" ["de"]="de-DE" ["el"]="el-GR" ["es"]="es-ES" ["eu"]="eu-ES"
0023                            ["fi"]="fi-FI" ["fr"]="fr-FR" ["gl"]="gl-ES" ["he"]="iw-IL" ["hu"]="hu-HU" ["is"]="is-IS" ["it"]="it-IT"
0024                            ["ja"]="ja-JP" ["ka"]="ka-GE" ["ko"]="ko-KR" ["nl"]="nl-NL" ["nn"]="no-NO" ["pl"]="pl-PL" ["pt"]="pt-PT"
0025                            ["ru"]="ru-RU" ["sv"]="sv-SE" ["ta"]="ta-IN" ["tr"]="tr-TR")
0026     for lang in "${!to_rename[@]}"; do
0027         if [ -d $podir/$lang ]; then
0028             mv $podir/$lang $podir/${to_rename[$lang]}
0029         fi
0030     done
0031     for lang in $(ls $podir); do
0032         if [ -f $podir/$lang/kdeconnect-android-store-short.po -a -f $podir/$lang/kdeconnect-android-store-full.po ]; then
0033             mkdir -p ./metadata/android/$lang/
0034             cp ./metadata/android/en-US/title.txt ./metadata/android/$lang/title.txt # we do not translate the app name
0035             po2txt --fuzzy --progress=names -i $podir/$lang/kdeconnect-android-store-short.po -o ./metadata/android/$lang/short_description.txt
0036             po2txt --fuzzy --progress=names -i $podir/$lang/kdeconnect-android-store-full.po -o ./metadata/android/$lang/full_description.txt
0037         fi
0038     done
0039 }
0040