blob: 04f65c148d66442f97f7a7d7bf2656dbd37b4a24 [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 Bestaseb4629a2018-11-14 23:03:18 +020011The Java variant of crowdin is required for this to work.
Marco Brohet680098c2014-02-28 01:21:52 +010012
Michael Bestaseb4629a2018-11-14 23:03:18 +020013 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 Brohet680098c2014-02-28 01:21:52 +010016
Michael W1bb2f922019-02-27 17:46:28 +010017python-git is used for Git integration, python-yaml is used for parsing configuration files:
Marco Brohet680098c2014-02-28 01:21:52 +010018
Michael W1bb2f922019-02-27 17:46:28 +010019 sudo apt-get install python-git python-yaml
Marco Brohet680098c2014-02-28 01:21:52 +010020
Michael Bestas6953f732018-11-14 23:47:41 +020021Copy <lineage_version>_extra_packages.xml to .repo/local_manifests of each <lineage_version> tree
Michael Bestas42e25e32016-03-12 20:18:39 +020022to 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.
Michael Bestaseb4629a2018-11-14 23:03:18 +020027Each LineageOS version requires a different environment variable set for the base path that depends on the branch name:
Michael Bestasf40f4392015-06-05 17:02:35 +030028
Michael Bestaseb4629a2018-11-14 23:03:18 +020029 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
Joeyb7221632019-01-07 21:12:58 +010034 export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_16_0=your_16.0_base_path
Michael Bestas432919a2016-03-12 21:16:20 +020035
36Example:
Michael Bestas09c7c0a2016-03-14 23:12:22 +020037
Michael Bestaseb4629a2018-11-14 23:03:18 +020038 export LINEAGE_CROWDIN_API_KEY=1234567890
39 export LINEAGE_AOSP_CROWDIN_API_KEY=0987654321
40 export LINEAGE_CROWDIN_BASE_PATH_CM_13_0=/mnt/android/lineageos/cm-13.0
41 export LINEAGE_CROWDIN_BASE_PATH_CM_14_1=/mnt/android/lineageos/cm-14.1
Joeyb7221632019-01-07 21:12:58 +010042 export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_15_1=/mnt/android/lineageos/lineage-15.1
43 export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_16_0=/mnt/android/lineageos/lineage-16.0
Michael Bestasf40f4392015-06-05 17:02:35 +030044
Michael Bestas26376ba2014-07-27 22:40:56 +030045Execute:
Michael Bestas2ea4e102014-04-05 13:25:33 +030046
Michael Wd13658a2019-01-13 14:05:37 +010047 ./crowdin_sync.py --username your_gerrit_username --branch lineage_version [--upload-sources] [--upload-translations] [--download] [--submit]
Marco Brohet (cobje)9229f9a2014-02-28 12:39:03 +010048
49Bugs
50----
Marco Brohet8b78a1b2014-02-28 21:01:26 +010051 - When committing fails, the reason of it cannot be determined. Often this is just when there
52 are no new translations, so the script will not exit when this happens.