File indexing completed on 2024-09-15 03:27:05
0001 #!/usr/bin/env bash 0002 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 EXPORTS_POT_DIR=1 0006 FILE_PREFIX=docs_digikam_org_ 0007 0008 function export_pot_dir # First parameter will be the path of the directory where we have to store the pot files 0009 { 0010 echo "Creating POT files in $1" 0011 potdir=$1 0012 make gettext 0013 cd build/gettext 0014 #rm -rf untranslatable_pages.pot untranslatable_pages 0015 # Flatten the dir structure 0016 echo "> Add docs_digikam_org_ prefix" 0017 find * -type f -exec bash -c 'new=$(echo "{}" | sed s#/#___#g); mv "{}" "docs_digikam_org_$new"' \; 0018 echo "> Move files to $1" 0019 mv *.pot $potdir 0020 #echo "> clean up" 0021 #rm -rf * 0022 } 0023 0024 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 0025 { 0026 # echo "Import PO dirs: $1" 0027 podir=$1 0028 mkdir -p locale 0029 # for some reason sphinx uses nb_NO instead of nb 0030 if [ -d $podir/nb ]; then 0031 mv $podir/nb $podir/nb_NO 0032 fi 0033 # for some reason sphinx uses uk_UA instead of uk 0034 if [ -d $podir/uk ]; then 0035 mv $podir/uk $podir/uk_UA 0036 fi 0037 # for some reason sphinx uses pt_PT instead of pt 0038 if [ -d $podir/pt ]; then 0039 mv $podir/pt $podir/pt_PT 0040 fi 0041 # These are the language codes that sphinx supports. 0042 # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language 0043 # -> Languages supported by sphinx, but not supported by KDEs l10n: cak – Kaqchikel, hi_IN – Hindi (India), 0044 # sr@latin – Serbian (Latin), sr_RS – Serbian (Cyrillic), ur – Urdu 0045 for lang in ar bg bn ca cs cy da de el eo es et eu fa fi fr he hi hr hu id it ja ko lt lv mk nb_NO ne nl pl pt_BR pt_PT ro ru si sk sl sq sr sv ta te tr uk_UA vi zh_CN zh_TW 0046 do 0047 if [ -d "$podir/$lang" ]; then 0048 echo "> processing language $lang" 0049 rm -rf locale/$lang/LC_MESSAGES 0050 mkdir -p locale/$lang/LC_MESSAGES 0051 echo locale/$lang/LC_MESSAGES 0052 mv $podir/$lang/*.po locale/$lang/LC_MESSAGES 0053 cd locale/$lang/LC_MESSAGES 0054 # Recreate the dir structure 0055 find * -type f -exec bash -c 'new=$(echo "{}" | sed s#docs_digikam_org_##g | sed s#___#/#g); mkdir -p `dirname $new`; mv "{}" $new' \; 0056 cd ../../.. 0057 rm -rf $podir/$lang 0058 fi 0059 done 0060 ls $podir # This will "complain" about languages that are translated but unsupported in sphinx, once we have one we'll have to think what to do 0061 }