Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 1 | crowdin_sync.py |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 2 | ================== |
| 3 | |
| 4 | Introduction |
| 5 | ------------ |
Abhisek Devkota | b78def4 | 2016-12-27 13:06:52 -0800 | [diff] [blame] | 6 | This script is used to synchronize LineageOS' translations with Crowdin's. Also, it can handle |
Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 7 | automatic commiting to Gerrit and pushing/downloading to/from Crowdin. |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 8 | |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 9 | Prerequisites |
| 10 | ------------- |
Michael Bestas | 44fbb35 | 2015-12-17 02:01:42 +0200 | [diff] [blame] | 11 | The Ruby variant of crowdin-cli >= 0.5.2 is required for this to work. |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 12 | |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 13 | \curl -sSL https://get.rvm.io | bash -s stable --ruby |
Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 14 | source /home/your_username/.rvm/scripts/rvm # Add this to your .bashrc file! |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 15 | rvm all do gem install crowdin-cli |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 16 | |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 17 | python-git is used for Git integration. |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 18 | |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 19 | sudo apt-get install python-git |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 20 | |
Michael Bestas | 42e25e3 | 2016-03-12 20:18:39 +0200 | [diff] [blame] | 21 | Copy <cm_version>_extra_packages.xml to .repo/local_manifests of each <cm_version> tree |
| 22 | to make sure you sync all the extra packages not included in the main manifest. |
| 23 | |
Marco Brohet | 3e5334a | 2014-02-28 01:16:37 +0100 | [diff] [blame] | 24 | Executing |
| 25 | --------- |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 26 | Export the following environment variables to set the API keys and the base path. |
Abhisek Devkota | b78def4 | 2016-12-27 13:06:52 -0800 | [diff] [blame] | 27 | Base path should contain all LineageOS trees in subfolders, named after LineageOS branches. |
Michael Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 28 | Syncing stable trees requires an additional environment variable plus a 'stable' |
| 29 | subfolder under the base path, due to crowdin API limitations: |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 30 | |
| 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 Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 34 | export CM_CROWDIN_STABLE_BASE_PATH=your_stable_base_path |
| 35 | |
| 36 | Example: |
Michael Bestas | 09c7c0a | 2016-03-14 23:12:22 +0200 | [diff] [blame] | 37 | |
Michael Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 38 | export CM_CROWDIN_API_KEY=1234567890 |
| 39 | export CM_AOSP_CROWDIN_API_KEY=0987654321 |
Abhisek Devkota | b78def4 | 2016-12-27 13:06:52 -0800 | [diff] [blame] | 40 | export CM_CROWDIN_BASE_PATH=/mnt/android/lineageos |
| 41 | export CM_CROWDIN_STABLE_BASE_PATH=/mnt/android/lineageos/stable |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 42 | |
Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 43 | Execute: |
Michael Bestas | 2ea4e10 | 2014-04-05 13:25:33 +0300 | [diff] [blame] | 44 | |
Michael Bestas | db69b93 | 2016-03-12 21:08:27 +0200 | [diff] [blame] | 45 | ./crowdin_sync.py --username your_gerrit_username --branch cm_version --ticket jira_id [--upload-sources] [--upload-translations] [--download] |
Marco Brohet (cobje) | 9229f9a | 2014-02-28 12:39:03 +0100 | [diff] [blame] | 46 | |
| 47 | Bugs |
| 48 | ---- |
Marco Brohet | 8b78a1b | 2014-02-28 21:01:26 +0100 | [diff] [blame] | 49 | - 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 Bestas | 2ea4e10 | 2014-04-05 13:25:33 +0300 | [diff] [blame] | 51 | |
| 52 | Submitting changes |
| 53 | ------------------ |
| 54 | This repository is preconfigured to use the git-review plugin. More information can be found at: |
| 55 | https://pypi.python.org/pypi/git-review |
| 56 | |
| 57 | You can upload your change to gerrit with commands like these: |
| 58 | |
| 59 | git add * |
| 60 | git commit |
| 61 | git review |