po: Switch from Zanata to Weblate

Fixes: #13319
Closes: #13373
This commit is contained in:
Matej Marusak 2020-01-09 11:05:21 +01:00 committed by Martin Pitt
parent e6355fdb97
commit 9cc6b230e4
4 changed files with 29 additions and 33 deletions

2
.gitignore vendored
View File

@ -40,7 +40,6 @@ config.sub
/configure
depcomp
/.sass-cache
/.zanata-cache
/lang/da.json
/lang/de.json
/com.redhat.Cockpit.service
@ -100,6 +99,7 @@ depcomp
/po/cockpit.pot
/po/*.in
/po/*.pot
tmp/weblate-repo
/src/selinux/tmp
/src/selinux/cockpit.pp
/bots/

View File

@ -54,10 +54,10 @@ Translation process
Running `make po/cockpit.pot` will generate a standard PO template.
* With `make upload-pot` the PO template gets uploaded to the
[Zanata translation platform](https://fedora.zanata.org/iteration/view/cockpit/master)
[Weblate translation platform](https://translate.stg.fedoraproject.org/projects/cockpit/)
where everybody can contribute translations to various languages.
* With `make download-po` Zanata's translations are downloaded to
* With `make download-po` Weblate's translations are downloaded to
`po/XX.po`. This is done by
[bots/po-refresh](https://github.com/cockpit-project/cockpit/blob/master/bots/po-refresh)
which is invoked regularly by
@ -65,8 +65,9 @@ Translation process
* Translations can also be done using any other tool or platform and be
submitted via pull requests that update the `po/XX.po` files. In this case
they should then also be uploaded to Zanata again with
`make upload-translations`.
they should then also be uploaded to Weblate either manually using Weblate UI
or by pushing these files into [cockpit-weblate](https://github.com/cockpit-project/cockpit-weblate)
repository.
Using translations at runtime
-----------------------------
@ -86,16 +87,16 @@ Opening a new branch
Occasionally we create a new upstream branch for e. g. a new stable RHEL
release. Run these steps to initialize translations for it:
* On the [Zanata Cockpit project page](https://fedora.zanata.org/project/view/cockpit),
open the … menu in "Versions" and create a "New Version". Give it a name
that matches the new branch, and import existing translations from master
(or another branch if that's more appropriate). This will take a while to
get initialized.
* In [cockpit-weblate](https://github.com/cockpit-project/cockpit-weblate) create a new branch
with the same name.
Upload there `cockpit.pot` that you generated from the new upstream branch with `make po/cockpit.pot`.
If you have also `.po` files, you can also add them into this branch.
* On the new cockpit branch, change `<project-version>` in
[po/zanata.xml](https://github.com/cockpit-project/cockpit/blob/master/po/zanata.xml)
* On the [Weblate Cockpit project page](https://translate.stg.fedoraproject.org/projects/cockpit/),
click the "Add new translation component" button and create a new component. Give it a name
that matches the new branch. Point it to [cockpit-weblate](https://github.com/cockpit-project/cockpit-weblate)
repository to a branch you created in the previous step.
* On the new cockpit branch, change `WEBLATE_REPO_BRANCH` in
[po/Makefile.am](https://github.com/cockpit-project/cockpit/blob/master/po/Makefile.am)
from "master" to the new branch name.
* Run `make upload-pot upload-translations` to push the current translations
from git to it. The majority should already exist through the import from
above, but this makes sure the translations are completely in sync.

View File

@ -4,6 +4,10 @@ GETTEXT_PACKAGE = cockpit
# The concrete set of linguas we are using
LINGUAS = $(shell cat $(srcdir)/po/LINGUAS)
WEBLATE_REPO=tmp/weblate-repo
WEBLATE_REPO_URL=https://github.com/cockpit-project/cockpit-weblate.git
WEBLATE_REPO_BRANCH=master
# The full list of various input and output file types
PO_LINGUAS = $(addprefix po/,$(LINGUAS))
PO_INPUTS = $(addsuffix .po,$(PO_LINGUAS))
@ -114,20 +118,19 @@ update-po: po/cockpit.pot
$(MSGMERGE) --output-file=$(srcdir)/po/$$lang.po $(srcdir)/po/$$lang.po $<; \
done
ZANATA_CLI = LANG=C.UTF-8 LC_ALL=C.UTF-8 zanata
$(WEBLATE_REPO):
git clone --depth=1 -b $(WEBLATE_REPO_BRANCH) $(WEBLATE_REPO_URL) $(WEBLATE_REPO)
upload-pot: po/cockpit.pot
$(ZANATA_CLI) push -f --srcdir=$(builddir)/po --push-type=source --project-config=$(srcdir)/po/zanata.xml cockpit.pot
upload-translations: po/cockpit.pot
$(ZANATA_CLI) push -f --srcdir=$(srcdir)/po --push-type=target \
--transdir=$(srcdir)/po --project-config=$(srcdir)/po/zanata.xml
upload-pot: po/cockpit.pot $(WEBLATE_REPO)
cp $(builddir)/po/cockpit.pot $(WEBLATE_REPO)
git -C $(WEBLATE_REPO) commit -m "Update source file" -- cockpit.pot
git -C $(WEBLATE_REPO) push
clean-po:
rm $(srcdir)/po/*.po
download-po:
$(ZANATA_CLI) pull --min-doc-percent 50 --transdir=$(srcdir)/po --project-config=$(srcdir)/po/zanata.xml
download-po: $(WEBLATE_REPO)
cp $(WEBLATE_REPO)/*.po $(srcdir)/po/
CLEANFILES += \
$(MO_FILES) \
@ -145,7 +148,6 @@ EXTRA_DIST += \
po/LINGUAS \
po/po.empty.js \
po/po2json \
po/zanata.xml \
po/its/polkit.its \
po/its/polkit.loc \
$(NULL)

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
<url>https://fedora.zanata.org/</url>
<project>cockpit</project>
<project-version>master</project-version>
<project-type>gettext</project-type>
</config>