https://github.com/r-dent/localizationsync
A python script that generates localization files for iOS and Android from a public GoogleSheet.
https://github.com/r-dent/localizationsync
android data-sync google-sheet gsheets ios l10n localization pip pypi python python-package python-script scripting
Last synced: 23 days ago
JSON representation
A python script that generates localization files for iOS and Android from a public GoogleSheet.
- Host: GitHub
- URL: https://github.com/r-dent/localizationsync
- Owner: r-dent
- License: mit
- Created: 2019-09-11T09:30:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-31T21:24:45.000Z (over 2 years ago)
- Last Synced: 2025-03-14T23:24:48.241Z (about 2 months ago)
- Topics: android, data-sync, google-sheet, gsheets, ios, l10n, localization, pip, pypi, python, python-package, python-script, scripting
- Language: Python
- Homepage:
- Size: 229 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Localization Sync
This is a python script that downloads localization strings and CI color information from a public [Google Sheet](https://docs.google.com/spreadsheets) and generates resource files for iOS and Android projects.
## Installation
This uses the [pip](https://packaging.python.org/en/latest/key_projects/#pip) package manager for Python packages ([see guide](https://packaging.python.org/en/latest/tutorials/installing-packages/)). It depends on the [pyexcel-ods](https://pypi.org/project/pyexcel-ods/) package which will be installed alongsite automatically when you run:
pip install localization-sync
Hint: It could be that you need to use `pip3` command instead of `pip`.
## Prerequisites
### 1. Create a Google Sheet
Create a Google Sheet document with sheets like [these](https://docs.google.com/spreadsheets/d/1672QPWDsxBtaX5hc5QgZhqBwLADMnPVEv7-wLB3g-ug):

Mind to __not__ add extra columns or rows at the top/left of your tables. I you need to do so, use `keyRow`/`keyColumn` parameters in config to inset the parsing of the table.
### 2. Publish
Publish the sheeet to the web by pressing __File -> Publish to the web__. Select __Whole Document__ and __Website__. This enables the script do export the contents of the sheet as ODS file.
_Note_: We are using the export instead of the JSON API. Because this way there is no need for creating an API Key and using OAuth on the client (your) side.
### 3. Get the ID
Find the ID of your document by copying it from your browsers address bar.

## Usage
Create a `data_sync.config.json` in your project and populate it with the contents of the [example config](data_sync.config.json). Replace the `sheetId` with your own. You can modify the other settings to fit the needs of your project.
Then open a terminal at your project path and run `l10n_sync`. Look for your newly created resource files.
You can also copy [data_sync.py](Sources/data_sync.py) to your project and then run `python3 data_sync.py` when your config file is ready.
## Example
Have a look into the [Output folder](Output) for some example files generated by using the provided [configuration file](data_sync.config.json).