0.1.1 • Published 2 years ago

translation-service-google-sheets v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Translation service from google sheets

The most unloved thing in the frontend is to write localization files, this library comes to your aid, which will help you

$ npm i translation-service-google-sheets -D

Usage/Examples

create file translate.js

import translate from 'translation-service-google-sheets';

// Initialize the sheet - doc ID is the long id in the sheets URL
// You can pass array of id
const docs = ["sdfasdfTRXX2y9KJt1Q0GEN1qnjpi13o"];

// Google api key
const apiToken = process.env.GOOGLE_PRIVATE_KEY;

// base path form root folder 
const basePath = "static";

const config = {
  docs,
  apiToken,
  basePath,
};

translate(config);
  node translate.js

Perfect!

Files are generated with names and folders as in the picture below

App Screenshot

Output

"easy": "to use",
"free": "example"

How can I use it additionally

"prebuild": "node translate.js",

Video example

Alt text

How to get api key

Setup Instructions

OPTIONAL

  • click "Restrict key" on popup to set up restrictions
  • Click "API restrictions" > Restrict Key"
  • Check the "Google Sheets API" checkbox
  • Click "Save"