{"id":19531497,"url":"https://github.com/alexanderwallin/transifex-api-es6","last_synced_at":"2025-04-26T13:31:53.499Z","repository":{"id":57379089,"uuid":"45931154","full_name":"alexanderwallin/transifex-api-es6","owner":"alexanderwallin","description":"A promise-based Transifex API client for node, written in es6","archived":false,"fork":false,"pushed_at":"2018-09-09T18:47:22.000Z","size":46,"stargazers_count":7,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T14:21:23.548Z","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/alexanderwallin.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-11-10T18:15:38.000Z","updated_at":"2020-06-17T02:52:05.000Z","dependencies_parsed_at":"2022-09-02T21:21:30.171Z","dependency_job_id":null,"html_url":"https://github.com/alexanderwallin/transifex-api-es6","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwallin%2Ftransifex-api-es6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwallin%2Ftransifex-api-es6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwallin%2Ftransifex-api-es6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwallin%2Ftransifex-api-es6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexanderwallin","download_url":"https://codeload.github.com/alexanderwallin/transifex-api-es6/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224036390,"owners_count":17245034,"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-11T01:43:09.291Z","updated_at":"2024-11-11T01:43:10.417Z","avatar_url":"https://github.com/alexanderwallin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![view on npm](http://img.shields.io/npm/v/transifex-api-es6.svg)](https://www.npmjs.org/package/transifex-api-es6)\n[![Dependency Status](https://david-dm.org/alexanderwallin/transifex-api-es6.svg)](https://david-dm.org/alexanderwallin/transifex-api-es6)\n\n# transifex-api-es6\n\nA promise-based Transifex API client for node, written in es6. Promises are thenable using the [q library](https://github.com/kriskowal/q).\n\nThe motivation behind this API is that there are no modern, promise-based JS API for Transifex out there that I could find. If found those that exist being difficult to overview or understand, so I started building on a new one.\n\n* [Installation](#Installation)\n* [Usage](#Usage)\n* [API Reference](#API_Reference)\n* [Contributing](#Contributing)\n\n\u003ca name=\"Installation\"\u003e\u003c/a\u003e\n## Installation\n\n```bash\nnpm install [--save] [--save-dev] transifex-api-es6\n```\n\n\u003ca name=\"Usage\"\u003e\u003c/a\u003e\n## Usage\n\n```javascript\nvar TransifexApi = require('transifex-api-es6');\n\nvar api = new TransifexApi({\n  user: 'username',\n  password: 'password',\n  projectName: 'my-project',\n  resourceName: 'customer-area' // optional\n});\n\n// Get resource translation\napi.getResourceTranslation('en')\n.then((contents) =\u003e {\n  // contents -\u003e PO contents as a string\n}, (err) =\u003e console.error(err));\n\n// Get translation strings\napi.getTranslationStrings('en', 'my_resource')\n.then((strings) =\u003e {\n  // strings -\u003e Set of string objects for 'my_resource'\n}, (err) =\u003e console.error(err))\n```\n\n\u003ca name=\"API_Reference\"\u003e\u003c/a\u003e\n## API Reference\n\n\n* [TransifexApi](#TransifexApi)\n  * [new TransifexApi(opts)](#new_TransifexApi_new)\n  * [.setResourceName(resourceName)](#TransifexApi+setResourceName)\n  * [.getProject()](#TransifexApi+getProject) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n  * [.getProjectLanguages()](#TransifexApi+getProjectLanguages) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n  * [.getResources()](#TransifexApi+getResources) ⇒ \u003ccode\u003earray\u003c/code\u003e\n  * [.getResource(resourceName)](#TransifexApi+getResource) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n  * [.createResource(resource)](#TransifexApi+createResource) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n  * [.deleteResource(resourceName)](#TransifexApi+deleteResource) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n  * [.getResourceTranslation(langCode, resourceName)](#TransifexApi+getResourceTranslation) ⇒ \u003ccode\u003estring\u003c/code\u003e\n  * [.getTranslationStrings(langCode, resourceName)](#TransifexApi+getTranslationStrings) ⇒ \u003ccode\u003estring\u003c/code\u003e\n\n\u003ca name=\"new_TransifexApi_new\"\u003e\u003c/a\u003e\n#### new TransifexApi(opts)\n\n| Param | Type | Description |\n| --- | --- | --- |\n| opts | \u003ccode\u003eObject\u003c/code\u003e | An object with required `projectName`, `user` and `password`                             fields. Optionally takes a `resourceName` which is stored as                             the default resource. |\n\n\u003ca name=\"TransifexApi+setResourceName\"\u003e\u003c/a\u003e\n#### transifexApi.setResourceName(resourceName)\nSets the default resource slug\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| resourceName | \u003ccode\u003estring\u003c/code\u003e | A resource slug |\n\n\u003ca name=\"TransifexApi+getProject\"\u003e\u003c/a\u003e\n#### transifexApi.getProject() ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns information about the project\n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - A project instance (wrapped in a promise)  \n\u003ca name=\"TransifexApi+getProjectLanguages\"\u003e\u003c/a\u003e\n#### transifexApi.getProjectLanguages() ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns an list of languages that belong to the project\n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - A list of languages (wrapped in a promise)  \n\u003ca name=\"TransifexApi+getResources\"\u003e\u003c/a\u003e\n#### transifexApi.getResources() ⇒ \u003ccode\u003earray\u003c/code\u003e\nReturns a list of resources in the project\n\n**Returns**: \u003ccode\u003earray\u003c/code\u003e - A list of the project's resources (wrapped in a promise)  \n\u003ca name=\"TransifexApi+getResource\"\u003e\u003c/a\u003e\n#### transifexApi.getResource(resourceName) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nReturns a resource\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| resourceName | \u003ccode\u003estring\u003c/code\u003e | (Optional) The slug of the requested resource. |\n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - A resource as JSON (wrapped in a promise)  \n\u003ca name=\"TransifexApi+createResource\"\u003e\u003c/a\u003e\n#### transifexApi.createResource(resource) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nCreates a new resources in the project\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| resource | \u003ccode\u003eObject\u003c/code\u003e | Dictionary with info about the resource |\n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - A q promise  \n\u003ca name=\"TransifexApi+deleteResource\"\u003e\u003c/a\u003e\n#### transifexApi.deleteResource(resourceName) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nDeletes a resource\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| resourceName | \u003ccode\u003estring\u003c/code\u003e | (Optional) The slug of the resource |\n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - A q promise  \n\u003ca name=\"TransifexApi+getResourceTranslation\"\u003e\u003c/a\u003e\n#### transifexApi.getResourceTranslation(langCode, resourceName) ⇒ \u003ccode\u003estring\u003c/code\u003e\nReturns a translation of a given (or default) resource in a given language\nas .po contents.\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| langCode | \u003ccode\u003estring\u003c/code\u003e | A language code, e.g. en_US |\n| resourceName | \u003ccode\u003estring\u003c/code\u003e | (Optional) A resource slug |\n\n**Returns**: \u003ccode\u003estring\u003c/code\u003e - A PO file as a string (wrapped in a promise)  \n\u003ca name=\"TransifexApi+getTranslationStrings\"\u003e\u003c/a\u003e\n#### transifexApi.getTranslationStrings(langCode, resourceName) ⇒ \u003ccode\u003estring\u003c/code\u003e\nReturns a set of translated strings of a given (or default) resource in a\ngiven language.\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| langCode | \u003ccode\u003estring\u003c/code\u003e | A language code, e.g. en_US |\n| resourceName | \u003ccode\u003estring\u003c/code\u003e | (Optional) A resource slug |\n\n**Returns**: \u003ccode\u003estring\u003c/code\u003e - A list of translation strings as JSON objects  \n                              (wrapped in a promise)  \n\n\u003ca name=\"Contributing\"\u003e\u003c/a\u003e\n## Contributing\n\nThis project is in early development. Issues and pull requests are more than welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderwallin%2Ftransifex-api-es6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexanderwallin%2Ftransifex-api-es6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderwallin%2Ftransifex-api-es6/lists"}