Skip to content

Commit

Permalink
Since there are other Lintian warnings regarding Bash functions in an…
Browse files Browse the repository at this point in the history
… sh script, fix those.
  • Loading branch information
tsimonq2 authored and redtide committed Nov 24, 2023
1 parent 8f423dd commit 164b9cf
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions bin/qtls-translate
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,45 @@
#
# Update translation files.
#===============================================================================
function usage
{

usage() {
printf "\nUse: lxqt-transupdate [source directory]\n"
exit 0
}

function lxqt_transupdate
{
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then usage; fi
lxqt_transupdate() {
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
fi

# Test for supported Qt version
local qtVersion_=$(qmake -query QT_VERSION|cut -d'.' -f1)
local qtVersion_=$(qmake -query QT_VERSION | cut -d'.' -f1)
local qVersions_="5 6"

if echo "${qVersions_[@]}" | grep -qw "$qtVersion_"; then supported_=1; fi
case $qVersions_ in
*"$qtVersion_"*) supported_=1 ;;
esac

if [ -z "$supported_" ]; then
printf "\nError: Qt%s is not supported. (Supported versions are: " "$qtVersion_"
printf "%s" "${qVersions_[0]}"
printf ", %s" "${qVersions_[@]:1}"
printf "%s" "${qVersions_%% *}"
printf ", %s" "${qVersions_#* }"
printf ')\n\n'
exit 1
fi

local sourcedir_=
local templates_=$(find . -name \*.ts | grep -v '_')

if [ -d "$1" ]; then sourcedir_="$1"; fi
if [ -d "$1" ]; then
sourcedir_="$1"
fi

for i in $templates_; do
local transdir_=$(dirname $i)
if [ "$sourcedir_" == "" ]; then sourcedir_=$(dirname $transdir_); fi
local transdir_=$(dirname "$i")
if [ "$sourcedir_" = "" ]; then
sourcedir_=$(dirname "$transdir_")
fi
local cmdUpdateTemplate="lupdate $sourcedir_ -ts $i -locations absolute -no-obsolete"
local cmdUpdateLanguage="lupdate $sourcedir_ -ts $transdir_/*_*.ts -locations absolute -no-obsolete"

Expand All @@ -79,4 +86,5 @@ function lxqt_transupdate
printf "\n"
done
}

lxqt_transupdate "${@}"

0 comments on commit 164b9cf

Please sign in to comment.