File indexing completed on 2024-12-08 05:05:48

0001 #!/bin/sh
0002 
0003 # Script that generates Messages.sh, which is a part of KDE translation process.
0004 
0005 separator="-"
0006 prefix=""
0007 suffix="_qt"
0008 subdir=""
0009 tag_file="l10n-kf5.tag"
0010 
0011 usage()
0012 {
0013         echo "usage: $0 cutehmi_dir [subdir] [prefix] [suffix] [separator]"
0014         echo "default subdir: $subdir"
0015         echo "default prefix: $prefix"
0016         echo "default suffix: $suffix"
0017         echo "default separator: $separator"
0018 }
0019 
0020 if [ $# -lt 1 ]; then
0021         echo "error: too few arguments"
0022         usage
0023         exit 1
0024 fi
0025 
0026 cutehmi_dir=$1
0027 
0028 if [ $# -gt 1 ]; then
0029         subdir=$2
0030 fi
0031 
0032 if [ $# -gt 2 ]; then
0033         prefix=$3
0034 fi
0035 
0036 if [ $# -gt 3 ]; then
0037         suffix=$4
0038 fi
0039 
0040 if [ $# -gt 4 ]; then
0041         separator=$5
0042 fi
0043 
0044 products=`find $cutehmi_dir/$subdir -name $tag_file -exec dirname {} \;`
0045 cutehmi_path=`readlink -f $cutehmi_dir`
0046 messages_path=$cutehmi_path/$messages_file
0047 
0048 for product in $products
0049 do
0050         product_path=`readlink -f $product`
0051         # Appending trailing slash to cutehmi_path removes also leading slash.
0052         stripped_path=${product_path#$cutehmi_path\/}
0053         translation_file=$prefix`echo ${product_path#$cutehmi_path\/$subdir\/} | sed 's|[./]|'$separator'|g' | awk '{ print tolower($0) }'`$suffix.pot
0054         echo \$EXTRACT_TR_STRINGS \`find ./$stripped_path -name \\*.qml -o -name \\*.cpp -o -name \\*.hpp\` -I ./$stripped_path/include -o \$podir/$translation_file
0055 done
0056