Stringify is a python tool for exporting localized strings files for Android and iOS (swift) projects from Google Docs spreadsheet.
- Install python 3
- Install dependencies: pygsheets and oauth2client with:
pip install -r requirements.txt
- Head to Google Developers Console and create a new project
- Enable Drive API and Spreadsheet API
- Save oauth credentials file as client_secret.json in project directory
- You are ready to go
You will be asked to login in to google docs on the first run. Copy token from redirected path http://localhost/code=TOKEN
and press enter. TOKEN will be stored in .credentials
file.
./stringify.py -h
optional arguments:
-h, --help show this help message and exit
-d DEFAULT_LANG, --default-lang DEFAULT_LANG
Android default language. Default language sets values
folder without language postfix. If left 'en' is set.
-n SPREADSHEET_NAME, --spreadsheet-name SPREADSHEET_NAME
Google Spreadsheet name.
-p DEST_PATH, --dest-path DEST_PATH
Localized strings destination path. Should point on
project/module directory (Used in both modes - IMPORT
and EXPORT).
-f FILENAME, --filename XML_FILENAME
Android xml or swift strings filename. Default:
strings.xml (Android), Localizable.strings (iOS)
-m MODE, --mode MODE Available modes: export_ios - exports/uploads ios
strings, export_android - exports/uploads android
strings, import_android - import/download Android
strings and create Google Spreadsheet, import_ios -
import/download iOS strings and create Google
Spreadsheet
-o LOGS_OFF, --logs-off LOGS_OFF
Turns progress debug logs off
-u OAUTH_CREDENTIALS_LOCATION, --oauth-credentials-location OAUTH_CREDENTIALS_LOCATION
oauth credentials location. Default: .google_credentials.json
- sample_spreadsheet is SPREADSHEET_NAME
- first row cells corespond strings languages
- first column cells are strings variable names
./stringify.py -n sample_spreadsheet -m import_android -f welcome.xml -p app/src/main/res
Result:
./stringify.py -n sample_spreadsheet -m import_ios -p resources
Result:
Feel free to ask me a question, report a bug(s), send request for new feature.