Zanata >=4 which is now on production utilizes REST API [1].
This commit fixes zanata_users.py to make compatible with
Zanata REST API and syncs translation_team.yaml up to date.
[1] http://zanata.org/zanata-platform/rest-api-docs/resource_LocalesResource.html
Change-Id: Ia99db310cff236797ef403ba5534d853ed63e3e3
Previously we kept the order of members of individual language teams
in the same order as that of Zanata language team page.
It was mainly to make it the maintenance of the YAML file
as the file is manually maintained.
We use zanata_users.py script to sync translation_team.yaml now,
so the need to keep the order has decreased much.
In addition, it seems Zanata changes the order of members
even when members of a specific language team is not changed.
This happens during the review https://review.openstack.org/#/c/485966/.
This commit change the script to sort members in the alphabetical order.
Change-Id: I09ddc202e0a3021bbc5433e37a5d815c760697ff
It is nice to specify the detail context in
https://review.openstack.org/#/c/448619/ and previous
comments written in translation_team.yaml output file.
Change-Id: I28543860771684ddc157175aa554d731dc7d512f
OpenStack user survey now supports translated surveys [1]
with kind contribution from many different countries.
Since openstack-user-survey project in Zanata [2] has a version
names openstack-user-survey which is different from master or stable-*,
including openstack-user-survey in ZANATA_VERSION_PATTERN
in zanata_stats.py file is needed to calculate ATC statistics
which deadline is Jul 10 - Jul 14 [3].
[1] https://www.openstack.org/user-survey
[2] https://translate.openstack.org/project/view/openstack-user-survey
[3] https://releases.openstack.org/pike/schedule.html
Change-Id: I8d4e61b7687c4d41f353662f2162362267cfc61a
* UTF-8 characters need to be handled differently with Python 2 and 3.
In Python 2 unicode strings must be encoded into ASCII strings.
Python 3 is naturely unicode-aware and there is no need to encode
unicode strings before passing the CSV writer.
* CSV writer in Python3 expects a file is open as
non-binary mode. In Python 2, binary mode is expected.
* Move the encoding logic to CSV writer. It is a bit tricky to have
encoded strings (i.e., byte string) in regular data structure.
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I9d678d86b540d8b188ec0bf3240628a288f7ad3c
Implements: blueprint python35-support
By changing this, two files can be executed without specifying python.
For example, not only
$ python tools/zanata/zanata_stats.py --help
supports, but also
$ tools/zanata/zanata_stats.py --help
is possible.
Note: please test using
$ tox -evenv --notest
$ source .tox/venv/bin/activate
Change-Id: Ia4b1bf07b17669428b77d324ff045299d17d8dc1
In Zanata 3.9.6 language team panel, language coordinators
are just shown as 'Coordinator'.
Previously 'Translator' and 'Reviewer' are shown as their role.
zanata_users.py script depends on what is displayed.
'translators' field in translation_team.yaml is used
in Stackalytics and zanata_stats.py. In the current situation,
activities in language coordinators are not retrieved.
Language coordinators can also be a translator and a reviewer
of corresponding language team, so this commit changes
zanata_users.py to add coordinators to translators and reviewers
of corresponding language.
Change-Id: Ia137998edb97dc45c576505a11e84d8e62000e81
translation_team.yaml is now sorted in the alphabetical order
of language codes, so the comment is no longer needed.
Change-Id: I2ef229a3f9b525f211203e9386d62f9dfd5b0663
After commit 8caba73ceb
translation_team.yaml is now sorted in the alphabeticaly order
of language codes. Before syncing this with Zanata,
this commit reorders the current translation_team.yaml
so that the subsequent commit highlights what are changed.
Change-Id: Ida13a3f1c46ff29df6fa8615c0e4820a2e6f496c
- Utilizes logging instead of oslo_log and catagorizs log messages
into debug, error, info, and warning logs.
- Implements --debug option to also see debug logs
(by default, debug logs are not seen to output).
Change-Id: Ib2b29896ca596f24cfb0c18602334435be6c2e13
The script generates a csv file by reading a yaml file
which contains the list of translators (e.g., translation_team.yaml)
with user name and e-mail addresses by interacting with Zanata API.
The script utilizes ZanataUtils in openstack-infra/project-config
to read zanata.ini configuration file which contains Zanata API key.
Note that the Zanata API key is required to use Zanata accounts API.
Change-Id: I078742c5956b2c72eb1dabb10b9d3b4667b8f7e6
* Convert more functions to class methods.
It allows us to have related stuffs in one place.
* Avoid using 'yield'. 'yield' itself is useful,
but there is no need to use this for small iterations.
Code readability will be better if we return a list.
* Raise an exception when an exception occurs in
read_uri() and read_json_from_uri(). Catching an exception
in these methods just leads to other unexpected error.
If reraising an exception brings, debugging will be easier.
* Move the sort logic to User.__lt__ method.
* Load language team YAML file after checking options.
Change-Id: I9b668e4606f783fbb87e920a4802947c7efe4eb3
* requests library handles differences in Python 2 and 3 efficiently.
Let's switch to requests rather than using the lower-level urllib.
* CSV writer in Python3 expects a file is open as
non-binary mode. In Python 2, binary mode is expected.
Change-Id: Ied870913de54975ea2d734e719f05c1e342620eb
Zanata 3.9.6 changes the format of statistics data.
This commit updates the tool to support 3.9.6.
The old format from the old Zanata used at translate.openstack.org
is no longer supported.
Closes-Bug: #1670638
Change-Id: I692a995142529c4df1e2664264afc19496bf71ed
We have a number of language team now.
translation_team.yaml is previously sorted based on the number
of translators, but it means the order of language teams can be
changed time to time. Alphabetical order will reduce accidental
big diff and makes easier to search.
Change-Id: Ib704d9f88d4ea7f6b18a390c956538072b52ac0d
HTML of individual language page was changed in Zanata 3.9.6.
This commit catches up with the change.
Closes-Bug: #1670725
Change-Id: I77df5c1f4b716b395f0f686b6a9e2e48649bedcf