npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-translations-from-spreadsheet

v1.4.2

Published

transform google spreadsheet to angular translations json files

Downloads

10

Readme

gulp-translations-from-spreadsheet

Build Status

Gulp plugin to generate translations json files for angular application from a google spreadsheet

IMPORTANT: If you do not want to use a service account, google spreadsheet must have no auth public permissions (e.g. Anyone with the link can view) and it should be explicitly published using "File > Publish to the web" menu option in the google spreadsheets GUI. this plugin is based on node-google-spreadsheet

Install

npm install gulp-translations-from-spreadsheet --save-dev

Basic Usage

This code will generate translation json files based on google spreadsheet:

'use strict';

var gulp = require('gulp');
var translations = require('gulp-translations-from-spreadsheet');

gulp.task('translations', function () {
  return translations({
          key: '1cKTLZCglRJkJR_7NGL6vPn1MHdadcLPUOMYjqVKFlB4',
          sheet: 1,
          colCount: 4,
          firstRow: 1,
          private_key_id: 'xxx',
          private_key: '-----BEGIN PRIVATE KEY-----\xxx\n-----END PRIVATE KEY-----\n',
          client_email: '[email protected]',
          client_id: 'xxx.apps.googleusercontent.com',
          ignoreCommentsColumn: false,
          warnOnMissingValues: true,
          errorOnMissingValues: false
      })
    .pipe(gulp.dest('./i18n'));
});

Options

key

Type: String: mandatory

Google spreadsheet key.
Example: https://docs.google.com/spreadsheets/d/1cKTLZCglRJkJR_7NGL6vPn1MHdadcLPUOMYjqVKFlB4/edit?usp=sharing

1cKTLZCglRJkJR_7NGL6vPn1MHdadcLPUOMYjqVKFlB4 is a key here

sheet

Type: Number: optional, default 1

NOTE: Worksheet id, ids start at 1

It is recommended that you DELETE all unused rows and columns in your spreadsheet to optimize load time, and only create additional columns and rows when needed.

The following two options allow you to specify a custom range of columns and rows if required.

firstRow

Type: Number: optional, default 1

NOTE: the index of the first row, start with 1

colCount

Type: Number: optional, default value from spreadsheet

NOTE: the number of valuable columns, it's better to specify this number, otherwise, it could be more than you expect

The following four options are required if you want to use a service account to authenticate (recommended):

private_key_id

Type: String: optional

The Google API private key id to use for authentication.

private_key

Type: String: optional

The Google API private key to use for authentication.

NOTE: You should never commit your private_key into your git repo. Rather you should use an ENV variable.

client_email

Type: String: optional

The Google API email to use for authentication. This account must have read access to the spreadsheet you want to pull the translations from.

client_id

Type: String: optional

The Google API client id to use for authentication.

ignoreCommentsColumn

Type: Boolean: optional, default false

If there is a column with the top cell labelled 'comments', this column will be skipped.

warnOnMissingValues

Type: Boolean: optional, default true

If there is a column lacking a given value, throw a warning in the console.

errorOnMissingValues

Type: Boolean: optional, default false

If there is a column lacking a given value, throw a fatal error and stop the task (recommended).


NOTE: there is link to alternative version of such gulp plugin