Skip to content

Commit

Permalink
Merge pull request #981 from pr2git/Translation
Browse files Browse the repository at this point in the history
updateallpo.sh switch to python3 since we are in python3 branch
  • Loading branch information
technl authored Jan 23, 2024
2 parents 8c19dbf + 4059a60 commit d1fa330
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion updateallpo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ else
fi
fi

#
# python version check that we are with python3
#
python_exec=""
which python3 > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
python_exec="python3"
else
which python > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
# Check if it is version 3
python_version=$(python --version | awk -F "." '{ gsub(/Python\s+/,"",$1); print $1; }')
if [[ ${python_version} -eq 3 ]]; then
python_exec="python"
else
python_exec=""
fi
fi
fi
[[ -z ${python_exec} ]] && { echo "No python 3 found, please install it or set it first into your PATH variable"; exit 1; }

echo "Python found: [${python_exec}]"

#
# On Mac OSX find option are specific
#
Expand Down Expand Up @@ -68,7 +91,7 @@ for directory in */po/ ; do
find $findoptions .. -name "*.py" -exec xgettext --no-wrap -L Python --from-code=UTF-8 -kpgettext:1c,2 --add-comments="TRANSLATORS:" -d $plugin -s -o $plugin-py.pot {} \+
$localgsed --in-place $plugin-py.pot --expression=s/CHARSET/UTF-8/
printf "Creating temporary file $plugin-xml.pot\n"
find $findoptions .. -name "*.xml" -exec python $rootpath/xml2po.py {} \+ > $plugin-xml.pot
find $findoptions .. -name "*.xml" -exec ${python_exec} $rootpath/xml2po-python3.py {} \+ > $plugin-xml.pot
printf "Merging pot files to create: %s.pot\n" $plugin
cat $plugin-py.pot $plugin-xml.pot | msguniq --no-wrap --no-location -o $plugin.pot -
rm $plugin-py.pot $plugin-xml.pot
Expand Down

0 comments on commit d1fa330

Please sign in to comment.