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. |
Michael Bestas | 602fab2 | 2018-11-14 23:14:33 +0200 | [diff] [blame] | 27 | Base path should contain all LineageOS trees in subfolders, named after LineageOS branches: |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 28 | |
| 29 | export CM_CROWDIN_API_KEY=your_api_key |
| 30 | export CM_AOSP_CROWDIN_API_KEY=your_aosp_api_key |
| 31 | export CM_CROWDIN_BASE_PATH=your_base_path |
Michael Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 32 | |
| 33 | Example: |
Michael Bestas | 09c7c0a | 2016-03-14 23:12:22 +0200 | [diff] [blame] | 34 | |
Michael Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 35 | export CM_CROWDIN_API_KEY=1234567890 |
| 36 | export CM_AOSP_CROWDIN_API_KEY=0987654321 |
Abhisek Devkota | b78def4 | 2016-12-27 13:06:52 -0800 | [diff] [blame] | 37 | export CM_CROWDIN_BASE_PATH=/mnt/android/lineageos |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 38 | |
Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 39 | Execute: |
Michael Bestas | 2ea4e10 | 2014-04-05 13:25:33 +0300 | [diff] [blame] | 40 | |
Michael Bestas | 80b22ef | 2018-11-14 23:12:33 +0200 | [diff] [blame^] | 41 | ./crowdin_sync.py --username your_gerrit_username --branch cm_version [--upload-sources] [--upload-translations] [--download] |
Marco Brohet (cobje) | 9229f9a | 2014-02-28 12:39:03 +0100 | [diff] [blame] | 42 | |
| 43 | Bugs |
| 44 | ---- |
Marco Brohet | 8b78a1b | 2014-02-28 21:01:26 +0100 | [diff] [blame] | 45 | - When committing fails, the reason of it cannot be determined. Often this is just when there |
| 46 | are no new translations, so the script will not exit when this happens. |