An open API service indexing awesome lists of open source software.

https://github.com/nventive/sheet2i18n


https://github.com/nventive/sheet2i18n

Last synced: 26 days ago
JSON representation

Awesome Lists containing this project

README

          

# Sheet2i18n

## Demo

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

## Installation

***Prerequisite:***

Node

***Steps:***

1. Install the latest version of the package from npm as a dev dependency:

```
npm i -D sheet2i18n
```

2. Create a `sheet2i18n.config.js` configuration file in your project's root directory:

```diff
my-app
├── node_modules
+ ├── sheet2i18n.config.js
└── package.json
```

3. Add and edit config values of your newly created `sheet2i18n.config.js` :

```title="sheet2i18n.config.js"
module.exports = {
exportPath: ,
tabsUrl: Array,
localesKey: Array,
};
```

***Example:***

```title="sheet2i18n.config.js"
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.

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

[Default] ConfigPath: "sheet2i18n.config"

```diff title="package.json"
"scripts": {
+ "sheet2i18n": "sheet2i18n "
}
```

***Example:***

```diff title="package.json"
"scripts": {
+ "sheet2i18n": "sheet2i18n src/app/utilities/config.sheet2i18n"
}
```

## Use

Run the following command in console.

```
npm run sheet2i18n
```

### Dependencies

* [axios/axios](https://github.com/axios/axios) - Promise based HTTP client for the browser and node.js.
* [adaltas/node-csv](https://github.com/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 example
|--- index.js <-- entry script
|--- package.json <-- defines build commands and dependencies

## License

This project is licensed under the Apache 2.0 license - see the
[LICENSE](LICENSE) file for details.