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 | eb4629a | 2018-11-14 23:03:18 +0200 | [diff] [blame] | 11 | The Java variant of crowdin is required for this to work. |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 12 | |
Michael Bestas | eb4629a | 2018-11-14 23:03:18 +0200 | [diff] [blame] | 13 | wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add - |
| 14 | echo 'deb https://artifacts.crowdin.com/repo/deb/ /' | sudo tee /etc/apt/sources.list.d/crowdin.list > /dev/null |
| 15 | sudo apt-get update && sudo apt-get install crowdin |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 16 | |
Michael W | 7820a79 | 2019-03-11 19:41:15 +0100 | [diff] [blame] | 17 | The following tools are also required to run the tool: |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 18 | |
Michael W | f52d15c | 2020-08-02 16:20:55 +0200 | [diff] [blame] | 19 | sudo apt-get install python3-git python3-yaml python3-lxml |
Marco Brohet | 680098c | 2014-02-28 01:21:52 +0100 | [diff] [blame] | 20 | |
Michael Bestas | 6953f73 | 2018-11-14 23:47:41 +0200 | [diff] [blame] | 21 | Copy <lineage_version>_extra_packages.xml to .repo/local_manifests of each <lineage_version> tree |
Michael Bestas | 42e25e3 | 2016-03-12 20:18:39 +0200 | [diff] [blame] | 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 | eb4629a | 2018-11-14 23:03:18 +0200 | [diff] [blame] | 27 | Each LineageOS version requires a different environment variable set for the base path that depends on the branch name: |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 28 | |
Michael Bestas | eb4629a | 2018-11-14 23:03:18 +0200 | [diff] [blame] | 29 | export LINEAGE_CROWDIN_API_KEY=your_api_key |
| 30 | export LINEAGE_AOSP_CROWDIN_API_KEY=your_aosp_api_key |
| 31 | export LINEAGE_CROWDIN_BASE_PATH_CM_13_0=your_13.0_base_path |
| 32 | export LINEAGE_CROWDIN_BASE_PATH_CM_14_1=your_14.1_base_path |
| 33 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_15_1=your_15.1_base_path |
Joey | b722163 | 2019-01-07 21:12:58 +0100 | [diff] [blame] | 34 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_16_0=your_16.0_base_path |
Michael W | f52d15c | 2020-08-02 16:20:55 +0200 | [diff] [blame] | 35 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_17_1=your_17.1_base_path |
Michael Bestas | 432919a | 2016-03-12 21:16:20 +0200 | [diff] [blame] | 36 | |
| 37 | Example: |
Michael Bestas | 09c7c0a | 2016-03-14 23:12:22 +0200 | [diff] [blame] | 38 | |
Michael Bestas | eb4629a | 2018-11-14 23:03:18 +0200 | [diff] [blame] | 39 | export LINEAGE_CROWDIN_API_KEY=1234567890 |
| 40 | export LINEAGE_AOSP_CROWDIN_API_KEY=0987654321 |
| 41 | export LINEAGE_CROWDIN_BASE_PATH_CM_13_0=/mnt/android/lineageos/cm-13.0 |
| 42 | export LINEAGE_CROWDIN_BASE_PATH_CM_14_1=/mnt/android/lineageos/cm-14.1 |
Joey | b722163 | 2019-01-07 21:12:58 +0100 | [diff] [blame] | 43 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_15_1=/mnt/android/lineageos/lineage-15.1 |
| 44 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_16_0=/mnt/android/lineageos/lineage-16.0 |
Michael W | f52d15c | 2020-08-02 16:20:55 +0200 | [diff] [blame] | 45 | export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_17_1=/mnt/android/lineageos/lineage-17.1 |
Michael Bestas | f40f439 | 2015-06-05 17:02:35 +0300 | [diff] [blame] | 46 | |
Michael Bestas | 26376ba | 2014-07-27 22:40:56 +0300 | [diff] [blame] | 47 | Execute: |
Michael Bestas | 2ea4e10 | 2014-04-05 13:25:33 +0300 | [diff] [blame] | 48 | |
Michael W | d13658a | 2019-01-13 14:05:37 +0100 | [diff] [blame] | 49 | ./crowdin_sync.py --username your_gerrit_username --branch lineage_version [--upload-sources] [--upload-translations] [--download] [--submit] |
Marco Brohet (cobje) | 9229f9a | 2014-02-28 12:39:03 +0100 | [diff] [blame] | 50 | |
| 51 | Bugs |
| 52 | ---- |
Marco Brohet | 8b78a1b | 2014-02-28 21:01:26 +0100 | [diff] [blame] | 53 | - When committing fails, the reason of it cannot be determined. Often this is just when there |
| 54 | are no new translations, so the script will not exit when this happens. |