{"id":19217079,"url":"https://github.com/8ctopus/sciter-i18n","last_synced_at":"2026-06-25T18:30:19.006Z","repository":{"id":47210287,"uuid":"374923866","full_name":"8ctopus/sciter-i18n","owner":"8ctopus","description":"A sciter.js translation engine","archived":false,"fork":false,"pushed_at":"2022-02-18T03:49:44.000Z","size":704,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T12:09:57.427Z","etag":null,"topics":["i18n","internationalization","localization","sciter-js","translation"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/8ctopus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-08T07:39:02.000Z","updated_at":"2022-12-27T10:43:39.000Z","dependencies_parsed_at":"2022-09-26T16:21:58.539Z","dependency_job_id":null,"html_url":"https://github.com/8ctopus/sciter-i18n","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fsciter-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fsciter-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fsciter-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8ctopus%2Fsciter-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8ctopus","download_url":"https://codeload.github.com/8ctopus/sciter-i18n/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100562,"owners_count":19747689,"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":["i18n","internationalization","localization","sciter-js","translation"],"created_at":"2024-11-09T14:20:02.333Z","updated_at":"2026-06-25T18:30:18.953Z","avatar_url":"https://github.com/8ctopus.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sciter i18n\n\n![latest version](https://img.shields.io/npm/v/sciter-i18n.svg)\n![downloads](https://img.shields.io/npm/dy/sciter-i18n.svg)\n\nA translation engine for [sciter.js](https://sciter.com/) on top of [i18next](https://www.i18next.com/).\n\n![sciter i18n screenshot](https://github.com/8ctopus/sciter-i18n/raw/master/screenshot.png)\n\n_NOTE_: From 4.4.8.14, sciter.js offers [native translation support](https://github.com/c-smile/sciter-js-sdk/blob/main/docs/md/reactor/JSX-i18n.md).\n\n## demo\n\n- git clone the repository\n- install packages `npm install`\n- install latest sciter sdk `npm run install-sdk`\n- start the demo `npm run scapp`\n\n## demo requirements\n\n- A recent version of Node.js `node` (tested with 22 LTS) and its package manager `npm`.\n    - On Windows [download](https://nodejs.dev/download/) and run the installer\n    - On Linux check the [installation guide](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04#option-2-%E2%80%94-installing-node-js-with-apt-using-a-nodesource-ppa)\n\n## add to your project\n\n### using npm\n\n- install package `npm install sciter-i18n`\n\n### copy source\n\n- add the `src` dir to your project\n- in `\u003cscript type=\"module\"\u003e`\n\n```js\n// import from npm package (preferred)\nimport I18n from \"node_modules/sciter-i18n/src/i18n.js\";\n\n// import from src dir (alternative)\nimport I18n from \"src/i18n.js\";\n\ndocument.on(\"ready\", async () =\u003e {\n    const locale = \"fr\";\n    const file = URL.toPath(__DIR__ + `locales/${locale}.json`);\n    const config = {\n        // i18n logging\n        logging: true,\n\n        // debug i18next\n        debug: true,\n\n        compatibilityJSON: 'v3',\n    };\n\n    // initialize translation engine\n    await I18n.init(locale, file, config);\n\n    // translate window\n    I18n.i18n(document);\n});\n```\n\n- create translation file `locales\\fr.json`\n\n```json\n{\n    \"translation\": {\n        \"key1\": \"test du moteur i18n\"\n    }\n}\n```\n\n- then in the html code add attribute `data-i18n` to all elements you want translated. If the `data-i18n` attribute value is set then it will be used as the translation key.\n\n```html\n\u003ch1 data-i18n=\"key1\"\u003ei18n engine test\u003c/h1\u003e\n```\n\n- otherwise the element's `innerText` will be the key\n\n```html\n\u003ch1 data-i18n\u003eh1\u003c/h1\u003e\n```\n\n## translate text in code\n\n```js\n// with 2 arguments, first serves as key, second as default value (better option)\nlet message = I18n.m(\"no-update\", \"Widget could not be updated.\");\n\n// with a single argument, it's both the key and the default value\nlet message = I18n.m(\"Widget could not be updated.\");\n```\n\n## interpolation\n\nThe basics\n\n```js\nlet message = I18n.m(\"Widget failed with error {{error_number}}.\", { eror_number: 18 });\n```\n\nInterpolation can also be set at initialization to apply to all translations.\n\n```js\nconst config = {\n    interpolation: {\n        defaultVariables: {\n            name: \"Yuri\",\n            country: \"Russia\",\n        },\n    },\n};\n\nI18n.init(locale, path, config);\n\nlet message = I18n.m(\"My name is {{name}} and I'm from {{country}}.\");\n```\n\n## todo\n\n- i18next file system backend or fetch backend\n- add missing ids to json\n- how to deal with interface refresh?\n- add hjson engine in order to be able to place comments in json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8ctopus%2Fsciter-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F8ctopus%2Fsciter-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8ctopus%2Fsciter-i18n/lists"}