GSheetStringsSyncer is a tool designed to facilitate two-way synchronization between Apple's *.strings
files and a Google Sheets document. This utility is particularly useful for managing localization in software development projects, allowing for efficient translation and localization management through Google Sheets.
Before you begin, ensure you have pyenv
installed on your system for managing multiple Python versions. If pyenv
is not installed, please follow the pyenv installation guide.
-
Install Python 3.10.4 using pyenv:
pyenv install 3.10.4
-
Set Python 3.10.4 as the local version:
pyenv local 3.10.4
-
Check the Python version (optional):
python --version # Output should be Python 3.10.4
It is recommended to use a virtual environment for Python projects to manage dependencies effectively.
-
Create a Virtual Environment (.venv): Navigate to your project's root directory and run:
python -m venv .venv
-
Activate the Virtual Environment:
- On Windows:
.venv\Scripts\activate
- On macOS and Linux:
source .venv/bin/activate
- On Windows:
-
Install Required Packages: If you have a
requirements.txt
file, install the required packages using:pip install -r requirements.txt
To use GSheetStringsSyncer, you'll need to provide several command-line arguments to specify the operation mode, Google Sheet URL, the name of the sheet, the path to the Resources folder, and the name of the localization file.
--operation
: Specify the operation mode, eitherupload
ordownload
.--sheet-url
: Provide the URL of the Google Sheet.--sheet-name
: Specify the name of the sheet within the Google Sheet document.--resources-path
: Set the path to the Resources folder containing the.strings
files.--file-name
: Provide the name of the localization file.
- Uploading to Google Sheets:
python gsheet_strings_syncer.py --operation upload --sheet-url "<SHEET_URL>" --sheet-name "<SHEET_NAME>" --resources-path "<RESOURCES_PATH>" --file-name "<FILE_NAME>"
- Downloading from Google Sheets:
python gsheet_strings_syncer.py --operation download --sheet-url "<SHEET_URL>" --sheet-name "<SHEET_NAME>" --resources-path "<RESOURCES_PATH>" --file-name "<FILE_NAME>"
Replace <SHEET_URL>
, <SHEET_NAME>
, <RESOURCES_PATH>
, and <FILE_NAME>
with your specific Google Sheet URL, sheet name, path to the Resources folder, and the name of your localization file, respectively.
- Ensure that the Google Sheets API is properly configured with the necessary credentials.
- Follow the specific format in the Google Sheet for the tool to work correctly (with comments in the first column, keys in the second column, and translations in subsequent columns).