{"_id":"@emirotin/i18n-google-spreadsheets","_rev":"1-d1ab30e3c27d1c78e94977734289923f","name":"@emirotin/i18n-google-spreadsheets","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@emirotin/i18n-google-spreadsheets","version":"0.1.0","description":"i18n using google sheets","main":"src/index.js","scripts":{"lint":"eslint src/**","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["i18n","internationalization","Google Spreadsheets"],"author":{"name":"Eugene Mirotin"},"contributors":[{"name":"Tanatorn Nantawinyoo"}],"license":"MIT","devDependencies":{"babel-eslint":"^10.1.0","eslint":"^6.8.0","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","prettier":"^1.19.1"},"dependencies":{"bluebird":"^3.7.2","commander":"^4.1.1","fs-extra":"^8.1.0","google-spreadsheet":"^3.0.9"},"bin":{"i18n-google-spreadsheets":"src/index.js"},"gitHead":"3c8727028a95c3b58cfbfbd5a6ff61af9ff0e1eb","_id":"@emirotin/i18n-google-spreadsheets@0.1.0","_nodeVersion":"10.19.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-qOImESnEx2JasCgIobYvnVFogSXeLVHBgBRFLgqstEZY9oh/GPQrLy7A4MV7yKJpL8JJ0nH1909AfoU4UC3i5w==","shasum":"6386a86d7c41d77203c8a6110a375974537e25d8","tarball":"https://registry.npmjs.org/@emirotin/i18n-google-spreadsheets/-/i18n-google-spreadsheets-0.1.0.tgz","fileCount":11,"unpackedSize":10897,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXl4RCRA9TVsSAnZWagAAMy8P/i5XqqawGOikn2XtVjEG\n4PRexHRTLAFICwww8SBS4idVjtqEJfl1PbkDWgRkTVVmXUOaT7hb+PX5+NJ6\nyeLCrgIudNINqDtjgilJHbXyVEJIZYYJjSQJsE5gqvFLHVKe0a3TrYH3iPYR\nr0IIM0XVLzIUizi13giTF2CNbH/x9Vucyib41yNMXAXvulfifJ4ibjs5JOrv\ne/o9HNLF6PgE7l2PoU/xUwEgz5iMwb6QtQx0hteqFgsPpRhYrKasdehAzWmQ\nolnEu+Nfs+7Bh96OSQwfiqyhFPaBbzqijugczxr76ccGQzltfO0PKGxT0xtQ\npX34UNLywHeTT0ugn4+XeS53JTxofSSchc2O2FxH1jF0kZvDzWS9fXbD5Zwb\nt7jE/8TRQ98oKm/ulDSTEycFPiiCod9/GRIM4+z2Hys2t1nQkPC4kFxdTc/q\n2oesy4lHnEhq/3gTR87Qow4DU+rKqcWAbBiY5rSfDCj9vWIhOABegHXijsD4\naBGlqoDoJcbc8OH7+R2h7l5tvZtVG2u4DcCZalvsmBRlhSWowBglkEjzsVfV\nchJoDVLjvhwwQ3gq40rrVaTvB80d/0D7z/LVHedtZA6lA9l4qepPkQ2+ReEY\nNcsKiupApNQ8VM9nlWQwGluSTgD2fFAUvD4ZUkfnpeiY+Z/L+CT7HgyzHrPT\nHNZ0\r\n=flt+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAMCQux6AI/gFA20z6CiiTt8bdGPsYoltia/sWGem096AiB4wZxTg5tCTSV9GoBlfScJ3fph6Ua1+97HI9uRB/KTRQ=="}]},"maintainers":[{"name":"emirotin","email":"emirotin@gmail.com"}],"_npmUser":{"name":"emirotin","email":"emirotin@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/i18n-google-spreadsheets_0.1.0_1583242768848_0.19678025314615244"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-03T13:39:28.820Z","0.1.0":"2020-03-03T13:39:28.943Z","modified":"2022-04-05T07:33:41.546Z"},"maintainers":[{"name":"emirotin","email":"emirotin@gmail.com"}],"description":"i18n using google sheets","keywords":["i18n","internationalization","Google Spreadsheets"],"contributors":[{"name":"Tanatorn Nantawinyoo"}],"author":{"name":"Eugene Mirotin"},"license":"MIT","readme":"# Introduction\n\n> The way for translations files to be generated using Google Spreadsheets.\n> This tools fetches the data from the Google Spreadsheets and creates the JSON files suitable for immediate usage with the tools like [i18next](https://www.i18next.com/) or later transformed to any format of the user's choice.\n\nThe project is a fork of the original `google-sheet-i18n` [by @tanatornn96](https://github.com/tanatornn96) with the following differences:\n\n- to handle the Google's [deprecation of its G-suite API v3](https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api) the dependency `google-spreadsheet` is upgraded to v3,\n- **Breaking**: to simplify the code custom formatters are removed, the only output format is JSON which can later be transformed by any tool of the user's choice,\n- the code was modernized and simplified,\n- Babel transpilation is removed, the code works with Node.js >= 10 which supports fair amount of ES6 features,\n- **Breaking**: categories are now case-sensitive, as well as the language column names must exactly match the configuration.\n\n# Setup\n\n## Google Spreadsheets Configuration\n\nEach sheet in the spreadsheet is transformed to a folder on the disc.\n\nThe first row of the sheet defines the (optional) categories, i18n keys, and the set of locales.\n\nEach subsequent row is a single i18n record:\n\n|  Category  | SubCategory | ... | Message |   en_CA   |   en_FR    | ... |\n| :--------: | :---------: | :-: | :-----: | :-------: | :--------: | :-: |\n| onboarding |   landing   | ... |  intro  |  Hello!   |  Bonjour!  | ... |\n| onboarding |   landing   | ... |  exit   | Good bye! | Au revior! | ... |\n\n## CLI Configuration\n\nConfiguration requires a credentials JSON file that can be obtained through Google's developer console with the following instructions (partially borrowed from [node-google-spreadsheet](https://github.com/theoephraim/node-google-spreadsheet)):\n\n1. Go to the [Google Developers Console](https://console.developers.google.com/project)\n2. Select your project or create a new one (and then select it)\n3. Enable the Drive API for your project\n\n- In the sidebar on the left, expand **APIs & auth** > **APIs**\n- Search for \"drive\"\n- Click on \"Drive API\"\n- click the blue \"Enable API\" button\n\n4. Create a service account for your project\n\n- In the sidebar on the left, expand **APIs & auth** > **Credentials**\n- Click blue \"Add credentials\" button\n- Select the \"Service account\" option\n- Select the \"JSON\" key type option\n- Click blue \"Create\" button\n- your JSON key file is generated and downloaded to your machine (**it is the only copy!**)\n- note your service account's email address (also available in the JSON key file)\n\n5. Share the doc (or docs) with your service account using the email noted above\n\n## Running the Translations\n\n1. `npm install -D @emirotin/i18n-google-spreadsheets`\n2. Create a `i18n-google-spreadsheets.config.js` file in the folder you wish to run the translations on.\n3. `npx i18n-google-spreadsheets fetch`\n\n## i18n Configuration\n\n```js\nvar path = require(\"path\");\n\nmodule.exports = {\n  categories: [\"category\", \"subcategory\", \"subcategory2\"],\n  credentialsPath: path.join(process.cwd(), \"credentials.json\"),\n  languages: [\"en_CA\", \"fr_CA\", \"es_ES\"],\n  sheetId: \"YOUR_SHEET_ID\"\n};\n```\n\n- `categories` - (required) The columns that defined the key names, for example, with the table above the first row will correspond to the `onboarding.landing.intro` key in the i18n file,\n- `delimiter` - (optional, default - '.') The delimiter used to join different categories to build the i18n key,\n- `credentialsPath` - (required) Absolute path to your crendentials JSON file,\n- `languages`: (required) The column in the sheet defining the i18n locales, each language corresponds to a single output file,\n- `sheetId` - (required) The ID of the Google Spreadsheet (can be found as part of its URL),\n- `output` - (required) An absolute path to the folder where locale files are saved.\n","readmeFilename":"README.md"}