1.0.2 • Published 1 year ago

sheet2i18n v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Sheet2i18n

Demo

Example SpreadSheet https://docs.google.com/spreadsheets/d/1qjNcJ4JEonpwRKVtkR99TOHif1plFsr5jUW2bLXwmhM/

Installation

Prerequisite:

Node.js v18

Steps:

  1. Install the latest version of the package from npm as a dev dependency:
npm i -D sheet2i18n
  1. Create a sheet2i18n.config.js configuration file in your project's root directory:
    my-app
    ├── node_modules
+   ├── sheet2i18n.config.js
    └── package.json
  1. Add and edit config values of your newly created sheet2i18n.config.js :
module.exports = {
    exportPath: <ExportPath>,
    tabsUrl: Array<TabUrl>,
    localesKey: Array<LocaleKey>,
};

Example:

    module.exports = {
        exportPath: "locales",
        tabsUrl: [
            "https://docs.google.com/spreadsheets/d/e/2PACX-1vR8qY9uP-jDrUMpZfk9BYk8qZZ7T-cj3xzEy9DAfauyVci_Od0qvG1EPTiYoNf-SpC_c4A04b54Jv8C/pub?gid=0&single=true&output=csv",
            "https://docs.google.com/spreadsheets/d/e/2PACX-1vR8qY9uP-jDrUMpZfk9BYk8qZZ7T-cj3xzEy9DAfauyVci_Od0qvG1EPTiYoNf-SpC_c4A04b54Jv8C/pub?gid=229463273&single=true&output=csv",
        ],
        localesKey: ["en", "fr", "es"],
    };

Go to (Google Sheet -> File -> Share -> Publish to web) to generate Google Sheet CSV publish url.

  1. Add the command in the scripts section of your package.json to use the sheet2i18n CLI:

Default ConfigPath: "sheet2i18n.config"

"scripts": {
+  "sheet2i18n": "sheet2i18n <ConfigPath>"
}

Example:

"scripts": {
+  "sheet2i18n": "sheet2i18n src/app/utilities/config.sheet2i18n"
}

Use

Run the following command in console.

npm run sheet2i18n

Dependencies

  • axios/axios - Promise based HTTP client for the browser and node.js.
  • adaltas/node-csv - Full featured CSV parser with simple api and tested against large datasets.

Project Structure

/sheet2i18n
|--- node_modules/          <-- generated by npm install
|--- bin/                   <-- binaries of the modules
|--- sheet2i18n.config.js   <-- modules configurations
|--- index.js               <-- entry script
|--- package.json           <-- defines build commands and dependencies

License

Licensed under the MIT License.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago