{"id":22050132,"url":"https://github.com/icapps/tree-house-translations","last_synced_at":"2026-04-13T01:05:03.150Z","repository":{"id":57379506,"uuid":"51327710","full_name":"icapps/tree-house-translations","owner":"icapps","description":"A node module to import the translations from the iCapps translations portal.","archived":false,"fork":false,"pushed_at":"2020-05-30T20:36:11.000Z","size":4749,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-30T02:42:26.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-08T21:16:31.000Z","updated_at":"2019-09-02T13:24:43.000Z","dependencies_parsed_at":"2022-09-02T21:22:48.201Z","dependency_job_id":null,"html_url":"https://github.com/icapps/tree-house-translations","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/icapps/tree-house-translations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Ftree-house-translations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Ftree-house-translations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Ftree-house-translations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Ftree-house-translations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icapps","download_url":"https://codeload.github.com/icapps/tree-house-translations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Ftree-house-translations/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262728063,"owners_count":23354691,"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-30T14:17:59.001Z","updated_at":"2026-04-13T01:05:03.114Z","avatar_url":"https://github.com/icapps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Treehouse translations\n\nImport and use translations from icapps translation service\n\n[![npm version](https://badge.fury.io/js/tree-house-translations.svg)](https://badge.fury.io/js/tree-house-translations)\n[![Dependencies](https://david-dm.org/icapps/tree-house-translations.svg)](https://david-dm.org/icapps/tree-house-translations.svg)\n[![Build Status](https://travis-ci.org/icapps/tree-house-translations.svg?branch=master)](https://travis-ci.org/icapps/tree-house-translations)\n[![Coverage Status](https://coveralls.io/repos/github/icapps/tree-house-translations/badge.svg)](https://coveralls.io/github/icapps/tree-house-translations) [![Greenkeeper badge](https://badges.greenkeeper.io/icapps/tree-house-translations.svg)](https://greenkeeper.io/)\n\n## Installation\n\nInstall via npm\n\n```shell\nnpm install tree-house-translations\n```\n\nor via yarn\n\n```shell\nyarn add tree-house-translations\n```\n\n## NodeJS\n\n```javascript\nconst translations = require('tree-house-translations');\n\ntranslations.import(apiUrl, apiToken, {\n  destination: __dirname + '/locales',  // Optional (defaults to ./src/locales)\n  clean: false,                         // Optional (defaults to true)\n  exportType: 'json' | 'plist',         // Defaults to json\n  seperateCategories : true,            // Optional (defaults to false)\n});\n```\n\n### initTranslator\n\nInitialise a translator object pointing to the `.json` files where are translations are being stored and set a default locale. This object contains all functions which you can use after initialisation.\n\nThis becomes a singleton instance which will cache your translations globally. **It is not possible at the moment to store translations into different folders.**\n\n```javascript\nimport { initTranslator } from 'tree-house-translations';\n\nconst translator = initTranslator('/locales', 'en');\ntranslator.translate(...);\n```\n\n\u003e The name of the translation file needs to match the language name.\n\u003e For example: /locales/en.json -\u003e en\n\n### .translate\n\nAfter initialising the translator you can easily find a translation value by its key for the required language in your localisation files.\n\n```javascript\ntranslator.translate('key_to_translate', 'nl');\n```\n\nYou can also replace values by using `{{}}` in your string values in the translation files.\n\n```javascript\ntranslator.translate('key_to_translate', 'en', { name: 'Brent' });\n```\n\n\u003e This is my new sentence from {{name}} -\u003e This is my new sentence from Brent\n\n## CLI\n\nInstall globally:\n\n```bash\nnpm install -g tree-house-translations\n```\n\nNow `translations` is available as a command. For instructions run:\n\n```bash\n$ translations help\n\n  Usage: translations [options] [command]\n\n  Commands:\n\n    init            setup a cnofiguration file based on the project type\n    import          import translations into this project\n    help [cmd]      display help for [cmd]\n```\n\nRun from your project root in order to setup the translations configuration.\n\n```bash\n$ translations init\n\n  Usage: translations-init [options]\n\n  Options:\n\n    -h, --help           output usage information\n    -V, --version        output the version number\n    --token [value]      Add apiToken\n    --translations-path  Add translations path\n    --verbose            get more detailed information on what is happening \n```\n\nRun from your project root in order to import the translations into the matching .json files.\n\n```bash\n$ translations import\n\n  Usage: translations-import [options]\n\n  Options:\n\n    -t, --token [value]    apiToken authentication token\n    --api-url [value]      api url e.g. 'http://server/api'\n    --seperate-categories  seperate translations in categories\n    --destination [value]  translations destionation path\n    --clean                clean import, delete all translations before writing new\n    --verbose              get more detailed information on what is happening\n    --export-type [value]  define export type. Options: (json, plist). Default: json\n```\n\n## Build the module\n\n```bash\n$ npm run build\n\n// build and keep watching\n$ npm run build:dev\n```\n\n## Bugs\n\nWhen you find issues, please report them:\n\n- web: [https://github.com/icapps/tree-house-translations/issues](https://github.com/icapps/tree-house-translations/issues)\n\nBe sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.\n\n## Authors\n\nSee the list of [contributors](https://github.com/icapps/tree-house-translations/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the ISC License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Ftree-house-translations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficapps%2Ftree-house-translations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Ftree-house-translations/lists"}