1.2.29 • Published 4 years ago

localize-gsheet-pro v1.2.29

Weekly downloads
63
License
-
Repository
-
Last release
4 years ago

Convert a Google Spreadsheet to a localization file

Installation

npm install localize-gsheet-pro -g

Supports 1. iOS, Android, js, 2. file splits from inline comments (only supports android)

Example

Given a Google Spreadsheet like this:
Spreadsheet example

Right now only good for android XML files where there comments with xxxx.xml and they will be split automatically.

The tool fetch the spreadsheet and write the result to a file in the Android or iOS format:

Result android Result iOS

Create a file update-localization.js

var Localize = require("localize-gsheet-pro");
var transformer = Localize.fromGoogleSpreadsheet("0Aq6WlQdq71FydDZlaWdmMEUtc2tUb1k2cHRBS2hzd2c", '*');
transformer.setKeyCol('KEY');

transformer.save("values/strings.xml", { valueCol: "NL", format: "android" });
transformer.save("values-fr/strings.xml", { valueCol: "FR", format: "android" });

transformer.save("nl.lproj/Localizable.strings", { valueCol: "NL", format: "ios" });
transformer.save("fr.lproj/Localizable.strings", { valueCol: "FR", format: "ios" });

transformer.save("values/strings.xml", { valueCol: "NL", format: "android" }, function(){
        transformer.programSplit ("values/" + "strings.xml", "values", "ZH");
});

Run it with

node update-localization.js

Advanced

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

Localize.fromGoogleSpreadsheet("<Key>", '*');
Localize.fromGoogleSpreadsheet("<Key>", ['HomeScreen, 'ContactScreen']);
Localize.fromGoogleSpreadsheet("<Key>", [0, 2]);

Notes

  • The script will preserve everything that is above the tags: < !-- AUTO-GENERATED --> or // AUTO-GENERATED
  • Your spreadsheet should be "Published" for this to work
  • You need to have git installed for the installation
1.2.29

4 years ago

1.2.28

4 years ago

1.2.24

4 years ago

1.2.25

4 years ago

1.2.26

4 years ago

1.2.23

4 years ago

1.2.22

4 years ago

1.2.16

4 years ago

1.2.14

4 years ago

1.2.15

4 years ago

1.2.13

4 years ago

1.2.12

4 years ago

1.2.11

4 years ago

1.2.4

4 years ago

1.2.0

4 years ago