blob: 665fd71d692d875e94e73543caba98820e5d55a6 [file] [log] [blame]
Michael Bestas26376ba2014-07-27 22:40:56 +03001crowdin_sync.py
Marco Brohet3e5334a2014-02-28 01:16:37 +01002==================
3
4Introduction
5------------
Abhisek Devkotab78def42016-12-27 13:06:52 -08006This script is used to synchronize LineageOS' translations with Crowdin's. Also, it can handle
Michael Bestas26376ba2014-07-27 22:40:56 +03007automatic commiting to Gerrit and pushing/downloading to/from Crowdin.
Marco Brohet3e5334a2014-02-28 01:16:37 +01008
Marco Brohet3e5334a2014-02-28 01:16:37 +01009Prerequisites
10-------------
Michael Bestas44fbb352015-12-17 02:01:42 +020011The Ruby variant of crowdin-cli >= 0.5.2 is required for this to work.
Marco Brohet680098c2014-02-28 01:21:52 +010012
Marco Brohet3e5334a2014-02-28 01:16:37 +010013 \curl -sSL https://get.rvm.io | bash -s stable --ruby
Michael Bestas26376ba2014-07-27 22:40:56 +030014 source /home/your_username/.rvm/scripts/rvm # Add this to your .bashrc file!
Marco Brohet3e5334a2014-02-28 01:16:37 +010015 rvm all do gem install crowdin-cli
Marco Brohet680098c2014-02-28 01:21:52 +010016
Marco Brohet3e5334a2014-02-28 01:16:37 +010017python-git is used for Git integration.
Marco Brohet680098c2014-02-28 01:21:52 +010018
Marco Brohet3e5334a2014-02-28 01:16:37 +010019 sudo apt-get install python-git
Marco Brohet680098c2014-02-28 01:21:52 +010020
Michael Bestas42e25e32016-03-12 20:18:39 +020021Copy <cm_version>_extra_packages.xml to .repo/local_manifests of each <cm_version> tree
22to make sure you sync all the extra packages not included in the main manifest.
23
Marco Brohet3e5334a2014-02-28 01:16:37 +010024Executing
25---------
Michael Bestasf40f4392015-06-05 17:02:35 +030026Export the following environment variables to set the API keys and the base path.
Abhisek Devkotab78def42016-12-27 13:06:52 -080027Base path should contain all LineageOS trees in subfolders, named after LineageOS branches.
Michael Bestas432919a2016-03-12 21:16:20 +020028Syncing stable trees requires an additional environment variable plus a 'stable'
29subfolder under the base path, due to crowdin API limitations:
Michael Bestasf40f4392015-06-05 17:02:35 +030030
31 export CM_CROWDIN_API_KEY=your_api_key
32 export CM_AOSP_CROWDIN_API_KEY=your_aosp_api_key
33 export CM_CROWDIN_BASE_PATH=your_base_path
Michael Bestas432919a2016-03-12 21:16:20 +020034 export CM_CROWDIN_STABLE_BASE_PATH=your_stable_base_path
35
36Example:
Michael Bestas09c7c0a2016-03-14 23:12:22 +020037
Michael Bestas432919a2016-03-12 21:16:20 +020038 export CM_CROWDIN_API_KEY=1234567890
39 export CM_AOSP_CROWDIN_API_KEY=0987654321
Abhisek Devkotab78def42016-12-27 13:06:52 -080040 export CM_CROWDIN_BASE_PATH=/mnt/android/lineageos
41 export CM_CROWDIN_STABLE_BASE_PATH=/mnt/android/lineageos/stable
Michael Bestasf40f4392015-06-05 17:02:35 +030042
Michael Bestas26376ba2014-07-27 22:40:56 +030043Execute:
Michael Bestas2ea4e102014-04-05 13:25:33 +030044
Michael Bestasdb69b932016-03-12 21:08:27 +020045 ./crowdin_sync.py --username your_gerrit_username --branch cm_version --ticket jira_id [--upload-sources] [--upload-translations] [--download]
Marco Brohet (cobje)9229f9a2014-02-28 12:39:03 +010046
47Bugs
48----
Marco Brohet8b78a1b2014-02-28 21:01:26 +010049 - When committing fails, the reason of it cannot be determined. Often this is just when there
50 are no new translations, so the script will not exit when this happens.
Michael Bestas2ea4e102014-04-05 13:25:33 +030051
52Submitting changes
53------------------
54This repository is preconfigured to use the git-review plugin. More information can be found at:
55https://pypi.python.org/pypi/git-review
56
57You can upload your change to gerrit with commands like these:
58
59 git add *
60 git commit
61 git review