Coder Social home page Coder Social logo

ours-curiosity / localize-with-spreadsheet-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neverwintermoon/localize-with-spreadsheet-2

0.0 1.0 0.0 1.93 MB

Create a localization file in Android or iOS format from a Google Spreadsheet. Version 2

JavaScript 100.00%

localize-with-spreadsheet-2's Introduction

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

Example

Given a Google Spreadsheet like this:
Spreadsheet example

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

const Localize = require('localize-with-spreadsheet')
const transformer = Localize.fromGoogleSpreadsheet('0Aq6WlQdq71FydDZlaWdmMEUtc2tUb1k2cHRBS2hzd2c', '*')
const properties = (value) => {
  return { valueCol: value, format: 'android' } // similarly, for iOS: { valueCol: value, format: 'ios' } 
}

transformer.setKeyCol('KEY')
transformer.save('values/strings.xml', properties('NL'));
transformer.save('values-fr/strings.xml', properties('FR'));

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

localize-with-spreadsheet-2's People

Contributors

neverwintermoon avatar xvrh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.