{"id":19151427,"url":"https://github.com/sc5/google-sheets-translate","last_synced_at":"2025-05-07T05:24:55.258Z","repository":{"id":43000179,"uuid":"43114564","full_name":"SC5/google-sheets-translate","owner":"SC5","description":"Maintain and collaborate your translations in Google Sheets","archived":false,"fork":false,"pushed_at":"2023-04-16T18:53:12.000Z","size":122,"stargazers_count":2,"open_issues_count":5,"forks_count":3,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-14T04:39:21.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SC5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-25T06:53:40.000Z","updated_at":"2022-03-24T05:28:39.000Z","dependencies_parsed_at":"2023-01-23T19:15:17.767Z","dependency_job_id":null,"html_url":"https://github.com/SC5/google-sheets-translate","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Fgoogle-sheets-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Fgoogle-sheets-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Fgoogle-sheets-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC5%2Fgoogle-sheets-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SC5","download_url":"https://codeload.github.com/SC5/google-sheets-translate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252819649,"owners_count":21809059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:14:41.557Z","updated_at":"2025-05-07T05:24:55.232Z","avatar_url":"https://github.com/SC5.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-sheets-translate\n\nMaintain your translations in Google Sheets and fetch them into JSON files - ready to be used other translation libraries like [Globalize](https://github.com/jquery/globalize)\n\n## Getting started\n\nSteps to get started with Google documents. See more verbose version in related project: https://github.com/SC5/google-sheets-api\n\n- Register app in [Google Developers Console](https://console.developers.google.com/project)\n- Enable Google Drive API\n- Create Service account under Credentials (get P12 key)\n- Convert P12 key into PEM format\n- Collect the service email account\n- Create Google Sheets -document\n- Share the document to service email address\n\n**NOTE:** Authentication is required - link based sharing is not currently supported.\n\nExample document:\n\n![Bonus: Use GOOGLETRANSLATE for creating initial translations](https://github.com/SC5/google-sheets-translate/raw/master/sheets.png)\n\nExample code:\n\n```javascript\nvar fs = require('fs');\n\nvar GoogleSheetsTranslate = require('google-sheets-translate');\n\nvar gtranslator = new GoogleSheetsTranslate({\n  documentId: 'your-document-id',\n  serviceEmail: 'your-generated-service-email@developer.gserviceaccount.com',\n  serviceKey: fs.readFileSync('./your-service.pem').toString()\n});\n\nvar output;\ngtranslator.getTranslations()\n.then(function(translations) {\n  translations.forEach(function(translation, locale) {\n    // In this example we're writing files in Globalize compatible format\n    output = {};\n    output[locale] = translation;\n    fs.writeFileSync(\n      'messages/' + locale + '.json',\n      JSON.stringify(output, null, 2)\n    );\n  });\n})\n.catch(function(err) {\n  console.warn('Failed to generate translations:', err);\n});\n```\n\nExample output:\n\n```json\n{\n  \"en\": {\n    \"translation\": \"Translation\",\n    \"dog-house\": \"Doghouse\",\n    \"sister\": \"Sister\"\n  }\n}\n```\n```json\n{\n  \"fi\": {\n    \"translation\": \"Käännös\",\n    \"dog-house\": \"Koirankoppi\",\n    \"sister\": \"Sisko\"\n  }\n}\n```\n\n## API\n\n#### new GoogleSheetsTranslate(opts)\n\nCreate an instance from the client. All the options are **required**.\n\n* @param {Object} opts               All the options\n* @param {String} id                 Sheets document id\n* @param {String} opts.serviceEmail  Service email address\n* @param {String} opts.serviceKey    Service .PEM key contents\n\n#### gstranslate.getTranslations(opts)\n\nRetrieve the translations from the sheet. All the options are **optional**.\n\n* @param {Object} opts               All the options\n* @param {String} opts.sheetOrdinal  Sheet ordinal to process. Defaults to 0 (first sheet)\n* @param {String} opts.sheetName     Sheet name to process. If not provided, uses sheetOrdinal\n* @param {String} opts.range         Range where the translations are. Defaults to whole document (first row contains the header)\n\n## License\n\nModule is MIT -licensed\n\n## Credit\n\nModule is backed by [Nordcloud](https://nordcloud.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc5%2Fgoogle-sheets-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsc5%2Fgoogle-sheets-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc5%2Fgoogle-sheets-translate/lists"}