blob: 2f400fd06979ac139ea5f49708cb6cf4c656c799 [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 W7820a792019-03-11 19:41:15 +010017The following tools are also required to run the tool:
Marco Brohet680098c2014-02-28 01:21:52 +010018
Michael Wf52d15c2020-08-02 16:20:55 +020019 sudo apt-get install python3-git python3-yaml python3-lxml
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 Wf52d15c2020-08-02 16:20:55 +020035 export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_17_1=your_17.1_base_path
Michael Bestas432919a2016-03-12 21:16:20 +020036
37Example:
Michael Bestas09c7c0a2016-03-14 23:12:22 +020038
Michael Bestaseb4629a2018-11-14 23:03:18 +020039 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
Joeyb7221632019-01-07 21:12:58 +010043 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 Wf52d15c2020-08-02 16:20:55 +020045 export LINEAGE_CROWDIN_BASE_PATH_LINEAGE_17_1=/mnt/android/lineageos/lineage-17.1
Michael Bestasf40f4392015-06-05 17:02:35 +030046
Michael Bestas26376ba2014-07-27 22:40:56 +030047Execute:
Michael Bestas2ea4e102014-04-05 13:25:33 +030048
Michael Wd13658a2019-01-13 14:05:37 +010049 ./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 +010050
51Bugs
52----
Marco Brohet8b78a1b2014-02-28 21:01:26 +010053 - 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.