diff --git a/MAINTAINING.md b/MAINTAINING.md index 1a267a888..84485a4ef 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -156,29 +156,22 @@ apply the normal rating process. # Translations from Weblate -Weblate provides an easy way for people to translate qTox. On one hand, it does -require a bit more attention & regular checking whether there are new -translations, on the other, it lessened problems that were happening with -"manual" way of providing translations. +Weblate provides an easy way for people to translate qTox. New translable strings need to be generated into a form Weblate can consume -using `./tools/update-translation-files.sh ALL` and commiting the result. +using `./tools/update-translation-files.sh ALL` and commiting the result. This +should be done as soon as strings are available since weblate follows our +branch, so is checked for in CI. -To get translations into qTox: +To get translations into qTox, fast-forward merge from +https://hosted.weblate.org/git/tox/qtox/. -1. Go to `https://hosted.weblate.org/projects/tox/qtox/#repository` and lock - the repository for translations. -2. Make sure you have git setup to automatically gpg sign commits. -3. To update translated strings from Weblate, in the root of the qTox - repository execute the script `tools/update-weblate.sh` -4. If a new translation language has been added, update the following files: - - `translations/CMakeLists.txt` - - `src/widget/form/settings/generalform.cpp` - - `translations/README.md` - - `translations/i18n.pri` - - `translations/translations.qrc` -5. After the Pull Request has been merged, `reset` Weblate to master and - unlock it. +If a new translation language has been added, update the following files: + - `translations/CMakeLists.txt` + - `src/widget/form/settings/generalform.cpp` + - `translations/README.md` + - `translations/i18n.pri` + - `translations/translations.qrc` # Releases @@ -211,6 +204,7 @@ To get translations into qTox: [`./tools/update-versions.sh`] script, e.g. `./tools/update-versions.sh 1.11.0` - Update toxcore version number to the latest tag in [`./buildscripts/download/download_toxcore.sh] +- Pull in latest translations from Weblate. - Update the bootstrap nodelist at `./res/nodes.json` from https://nodes.tox.chat/json. This can be done by running [`./tools/update-nodes.sh`] - Generate changelog with `clog`. @@ -259,7 +253,6 @@ helping for a while, ask to be added to the `qTox` organization on GitHub. [`CONTRIBUTING.md`]: /CONTRIBUTING.md [`merge-pr.sh`]: /merge-pr.sh [`test-pr.sh`]: /test-pr.sh -[`./tools/deweblate-translation-file.sh`]: /tools/deweblate-translation-file.sh [`./tools/create-tarball.sh`]: /tools/create-tarball.sh [`./tools/update-nodes.sh`]: /tools/update-nodes.sh [`./tools/update-versions.sh`]: /tools/update-versions.sh diff --git a/tools/deweblate-translation-file.sh b/tools/deweblate-translation-file.sh deleted file mode 100755 index 9c1029d2a..000000000 --- a/tools/deweblate-translation-file.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# Copyright © 2016 Zetok Zalbavar -# Copyright © 2019 by The qTox Project Contributors -# -# This file is part of qTox, a Qt-based graphical interface for Tox. -# qTox is libre software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qTox is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qTox. If not, see - -# Script to run to clean up translations from Weblate. -# -# It detects whether current HEAD commit seems to be a translation from -# Weblate, and if it is, it proceeds to update the translation commit by -# amending it. -# -# Note: the script assumes: -# * there is only 1 translation file modified -# * translation commit strictly adheres to consistent commit naming used -# * script is called from the root of repo -# -# If those assumptions aren't met, the end result won't be what you want. - -set -eu -o pipefail - -# get title of the last commit -get_commit_title() { - git log --format=format:%s HEAD~1..HEAD -} - -# get the whole commit message -get_whole_commit_name() { - git log --format=format:%B HEAD~1..HEAD -} - -# bool, whether HEAD commit is a weblate translation -is_webl_tr() { - local re='^feat\(l10n\): update .* translation from Weblate$' - local commit=$(get_commit_title) - [[ $commit =~ $re ]] -} - -# get filename of file to be updated -get_filename() { - local raw=( $(git log --raw | egrep '^:[[:digit:]]{6}' | head -n1) ) - local re='^translations/.+\.ts$' - [[ ${raw[5]} =~ $re ]] # check if that's actually right, if not, fail here - echo ${raw[5]} -} - -# call the other script to update && amend -update() { - local file=$(get_filename) - local commit_msg=$(get_whole_commit_name) - ./tools/update-translation-files.sh "$file" - git commit -S --amend -m "$commit_msg" "$file" -} - - -main() { - is_webl_tr \ - && update -} -main diff --git a/tools/update-weblate.sh b/tools/update-weblate.sh deleted file mode 100755 index 4e1595a70..000000000 --- a/tools/update-weblate.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -# Copyright © 2016 Zetok Zalbavar -# Copyright © 2019 by The qTox Project Contributors -# -# This file is part of qTox, a Qt-based graphical interface for Tox. -# qTox is libre software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qTox is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qTox. If not, see - -# Script to update the translations from Weblate. Works only if there are no -# merge conflicts. Assumes that working dir is a qTox git repo. -# -# Requires a GPG key to sign merge commits. - -# usage: -# ./$script - - -set -e -o pipefail - -readonly COMMIT_NAME="chore(l10n): update translations from Weblate - -" - -source_functions() { - local fns_file="tools/lib/PR_bash.source" - source $fns_file -} - -# If there's no qTox Weblate remote, add it -add_remote_weblate() { - local remote_url="https://hosted.weblate.org/git/tox/qtox/" - local remote_name="weblate" - - is_remote_present $remote_name \ - || git remote add $remote_name "${remote_url}" -} - -do_merge() { - # update commits - git fetch upstream - git fetch weblate - - git checkout upstream/master - - local COMMIT_MESSAGE=`git shortlog upstream/master..weblate/master` - - # squash and merge - git merge --squash --no-edit weblate/master - - # update format for adapt to Qt translation format - ./tools/deweblate-translation-file.sh ./translations/*.ts || true - - # commit - git commit --no-edit -S -m "$COMMIT_NAME" -m "$COMMIT_MESSAGE" -} - -main() { - source_functions - add_remote - add_remote_weblate - - do_merge - - echo "You can now checkout the changes with:" - echo "" - echo " git checkout -b " - echo "" -} -main