1.0.4 • Published 3 years ago

plan9-translation-parser v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Premise

This package can be used to parse translations from Google Sheets/Excel file to JSON files according to the sheet structure of the table

Example

Lets say we have a table that look something like this:

Sheet1:

ENRU
HelloПривет

Sheet2:

ENRu
WorldМир

We can use this lib to convert this to following file structure

┣ 📂translations

┃ ┣ 📂Sheet1

┃ ┣ 📜 EN.json

┃ ┣ 📜 RU.json

┃ ┣ 📂Sheet2

┃ ┣ 📜 EN.json

┃ ┣ 📜 RU.json

Usage

import  tl, {saveToDirectory} from  "plan9-translation-parser"
const sheets = ["mainpage", "otherpage"]

const getTranslations = async (method) => {
	//Parse it from Google Table
	if (method === "google") {
		return await  tl.parseFromGoogleSheets("tableID", sheets)
	}
	if (method === "excel") {
		return await  tl.parseFromXLSX("tableID", sheets)
	}
}
const sheetData = await getTranslations("google")

// Save it to folder
saveToDirectory(dirname, sheetData)
// Or to your DB
translationsRepository.saveTranslations(sheetData)
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago