2018-01-18 23:02:12 +00:00
|
|
|
#!/bin/bash
|
2015-02-22 19:13:36 +00:00
|
|
|
# Copyright 2015, Alexis La Goutte (See AUTHORS file)
|
|
|
|
#
|
|
|
|
# Resync translation between Gerrit repo and Transifex
|
|
|
|
|
2018-01-18 23:02:12 +00:00
|
|
|
NO_PUSH="False"
|
|
|
|
while getopts "n" OPTCHAR ; do
|
|
|
|
case $OPTCHAR in
|
|
|
|
n) NO_PUSH="True" ;;
|
2018-06-07 22:03:48 +00:00
|
|
|
*) printf "Unknown option: %s\\n" "$OPTARG"
|
2018-01-18 23:02:12 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
|
2021-01-17 18:38:27 +00:00
|
|
|
TOP_LEVEL=$(git rev-parse --show-toplevel)
|
|
|
|
if ! cd "$TOP_LEVEL" ; then
|
|
|
|
echo "Can't change to the top-level source directory."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
LUPDATE_INCLUDES=(-I .)
|
|
|
|
while read -r ; do
|
|
|
|
LUPDATE_INCLUDES+=(-I "$REPLY")
|
|
|
|
done < <(find "$TOP_LEVEL/ui/qt" -type d)
|
|
|
|
|
2018-06-07 20:04:38 +00:00
|
|
|
# All .cpp, .h, and .ui files under ui/qt
|
2021-01-17 18:38:27 +00:00
|
|
|
LUPDATE_FILES=()
|
|
|
|
while read -r ; do
|
|
|
|
LUPDATE_FILES+=("$REPLY")
|
|
|
|
done < <(find ui/qt -name '*.cpp' -o -name '*.h' -o -name '*.ui')
|
2018-01-18 23:02:12 +00:00
|
|
|
|
2017-07-16 19:10:50 +00:00
|
|
|
# Add line numbers
|
|
|
|
for i in ui/qt/*.ts ; do
|
2021-01-17 18:38:27 +00:00
|
|
|
lupdate -locations absolute "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i"
|
2017-07-16 19:10:50 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Get last translation for Transifex
|
2015-02-22 19:13:36 +00:00
|
|
|
tx pull -f
|
|
|
|
|
2017-07-16 19:10:50 +00:00
|
|
|
# Regenerate last translation for repo
|
2016-06-26 18:13:30 +00:00
|
|
|
for i in ui/qt/*.ts ; do
|
2021-01-17 18:38:27 +00:00
|
|
|
lupdate -locations absolute "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i"
|
2016-06-26 18:13:30 +00:00
|
|
|
done
|
2015-02-22 19:13:36 +00:00
|
|
|
|
2017-07-16 19:10:50 +00:00
|
|
|
# Push last change tranlastion on Transifex
|
2018-01-18 23:02:12 +00:00
|
|
|
if [ "$NO_PUSH" != "True" ]; then
|
|
|
|
tx push -t -s
|
|
|
|
fi
|
2015-02-22 19:13:36 +00:00
|
|
|
|
2017-07-16 19:10:50 +00:00
|
|
|
# Remove line numbers
|
|
|
|
for i in ui/qt/*.ts ; do
|
2021-01-17 18:38:27 +00:00
|
|
|
lupdate -locations none -no-ui-lines "${LUPDATE_INCLUDES[@]}" "${LUPDATE_FILES[@]}" -ts "$i"
|
2017-07-16 19:10:50 +00:00
|
|
|
done
|
|
|
|
|
2018-12-01 16:15:52 +00:00
|
|
|
#Add new commit with last translation update
|
2015-04-05 15:54:16 +00:00
|
|
|
#git commit -a -m "TX: Update Translations (sync)"
|
2015-02-22 19:13:36 +00:00
|
|
|
|
|
|
|
#Push update translation on Gerrit
|
|
|
|
#git push origin HEAD:refs/for/master/tx
|
|
|
|
|
|
|
|
#
|
|
|
|
# Editor modelines
|
|
|
|
#
|
|
|
|
# Local Variables:
|
|
|
|
# c-basic-offset: 4
|
|
|
|
# tab-width: 8
|
|
|
|
# indent-tabs-mode: nil
|
|
|
|
# End:
|
|
|
|
#
|
|
|
|
# ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
# :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
#
|