3.0.0 • Published 3 years ago

localize-with-spreadsheet-2 v3.0.0

Weekly downloads
95
License
-
Repository
github
Last release
3 years ago

Convert a Google Spreadsheet to a localization file. Version 2

Installation

npm install localize-with-spreadsheet-2

Differences in version 2 (only major ones listed)

  • Preserve line breaks from the Google Sheets
  • Uses newer version of google-spreadsheet which in turn supports the Google Sheets v4 API

Example

Requires:

Create a file update-localization.js

const Localize = require('localize-with-spreadsheet-2')

Localize.fromGoogleSpreadsheet('[api-key]', '[spreadsheet-key]', '*')
  .then(localizer => {
    localizer.setKeyCol('KEY') // name of the column containing the translation key

    Array.from(['en', 'de']).forEach(language => localizer.save(
      `project-name/resource/${language}.lproj/Localizable.strings`,
      { valueCol: language, format: 'ios' } // format can also be 'android' or 'json'
    ))
  })

Run it with node update-localization.js

Advanced

You can filter the worksheets to include with the third parameter of 'fromGoogleSpreadsheet':

Localize.fromGoogleSpreadsheet('[api-key]', '[spreadsheet-key]', '*')
Localize.fromGoogleSpreadsheet('[api-key]', '[spreadsheet-key]', '[mobile-app]')

Notes

  • The script will preserve everything that is above the tags: < !-- AUTO-GENERATED --> or // AUTO-GENERATED
3.0.0

3 years ago

2.2.1

4 years ago

2.2.0

6 years ago

2.1.2

6 years ago

2.1.1

7 years ago

2.1.0

7 years ago

0.2.1

7 years ago

2.0.0

7 years ago