Skip to content

Latest commit

 

History

History
78 lines (52 loc) · 1.61 KB

readme.md

File metadata and controls

78 lines (52 loc) · 1.61 KB

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"