pawelcala / stringify

Stringify is a python tool for exporting localized strings files for Android and iOS (swift) projects from Google Docs spreadsheet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stringify.py

Stringify is a python tool for exporting localized strings files for Android and iOS (swift) projects from Google Docs spreadsheet.

Installation steps:

  1. Install python 3
  2. Install dependencies: pygsheets and oauth2client with:
pip install -r requirements.txt
  1. Head to Google Developers Console and create a new project
  2. Enable Drive API and Spreadsheet API
  3. Save oauth credentials file as client_secret.json in project directory
  4. You are ready to go

How to use:

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.

More info:
./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:

Sample spreadsheet

  • sample_spreadsheet is SPREADSHEET_NAME
  • first row cells corespond strings languages
  • first column cells are strings variable names
Example: Download Android strings
./stringify.py -n sample_spreadsheet -m import_android -f welcome.xml -p app/src/main/res

Result:

Export Android

Example: Download iOS strings
./stringify.py -n sample_spreadsheet -m import_ios -p resources

Result:

Export iOS

Other:

Feel free to ask me a question, report a bug(s), send request for new feature.

About

Stringify is a python tool for exporting localized strings files for Android and iOS (swift) projects from Google Docs spreadsheet.


Languages

Language:Python 100.0%