{"id":18561202,"url":"https://github.com/apostrophecms/i18n-static","last_synced_at":"2026-01-28T11:01:48.970Z","repository":{"id":63199118,"uuid":"555464326","full_name":"apostrophecms/i18n-static","owner":"apostrophecms","description":"Edit translations of static text with i18next in A3","archived":false,"fork":false,"pushed_at":"2024-10-31T13:37:33.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T18:48:39.336Z","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/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-21T16:24:05.000Z","updated_at":"2025-05-14T11:17:37.000Z","dependencies_parsed_at":"2024-10-28T20:26:04.820Z","dependency_job_id":"5be5802e-cb76-473c-8344-7ba684cd460a","html_url":"https://github.com/apostrophecms/i18n-static","commit_stats":{"total_commits":31,"total_committers":4,"mean_commits":7.75,"dds":0.3548387096774194,"last_synced_commit":"a8696bdeb0672051eb2d5619727071889e9e51bd"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/apostrophecms/i18n-static","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fi18n-static","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fi18n-static/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fi18n-static/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fi18n-static/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/i18n-static/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fi18n-static/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28844421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-06T22:06:10.599Z","updated_at":"2026-01-28T11:01:48.953Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca id=\"contents\"\u003e\u003c/a\u003e\n\n# i18n-static\nEdit translations of static text with i18next\n\n1. [Installation](#1)\u003cbr\u003e\n2. [Configuration](#2)\u003cbr\u003e\n3. [Behavior](#3)\u003cbr\u003e\n4. [Import and export](#4)\u003cbr\u003e\n\nThis module makes it possible to edit the [translations of static text strings found in templates](https://v3.docs.apostrophecms.org/guide/localization/static.html) through the ApostropheCMS admin UI.\n\n\u003e This module is intended to localize static text in templates i.e text wrapped with `__(\"...\")`, **not localize editable content.** If your goal is content localization, you should use the [default localization feature in A3](https://v3.docs.apostrophecms.org/guide/localization/) instead.\n\n---\n\nJSON files used in Apostrophe are used by i18next. These resources are automatically converted as pieces through this module.\n\nThis will add an entry in the admin bar \"i18n Static Phrases\".\n\nOnly admin users have access to this module for now.\n\n\u003ca id=\"1\"\u003e\u003c/a\u003e\n\n## 1 Installation [\u0026#x2B06;](#contents)\n\nInstall the module with `npm i @apostrophecms/i18n-static` then declare it in the modules configuration in `app.js`:\n\n```js\n  modules: {\n    '@apostrophecms/i18n-static': {},\n  }\n```\n\n\u003ca id=\"2\"\u003e\u003c/a\u003e\n\n\n## 2 Configuration [\u0026#x2B06;](#contents)\n\nThe locales configuration comes from the i18n module in a A3 project. Usually, in `modules/@apostrophecms/i18n/index.js`. Example:\n\n```js\nmodule.exports = {\n  options: {\n    defaultLocale: 'en',\n    locales: {\n      en: { label: 'English' },\n      fr: {\n        label: 'French',\n        prefix: '/fr'\n      },\n      sk: {\n        label: 'Slovak',\n        prefix: '/sk'\n      },\n      es: {\n        label: 'Spanish',\n        prefix: '/es'\n      },\n      'pt-BR': {\n        label: 'Portuguese',\n        prefix: '/pt'\n      },\n      ar: {\n        label: 'Arabic',\n        prefix: '/ar'\n      }\n    }\n  }\n};\n```\n\nNamespaces group static texts. But if resources related to a specific namespace should not be created, it has to be excluded by configuring the array `excludeNamespaces` in the module's options.\n\n```js\n  modules: {\n    '@apostrophecms/i18n-static': {\n      options: {\n        excludeNamespaces: [ 'aposEvent', 'aposForm' ]\n      }\n    },\n  }\n```\n\nAs the `autopublish` option is set to `true` by default, new pieces will be created as draft and live. Change this option to `false` if `draft` is necessary before publishing them later (the `publish` batch feature will be helpful in this case).\n\n\u003ca id=\"3\"\u003e\u003c/a\u003e\n\n## 3 Behavior [\u0026#x2B06;](#contents)\n\nPieces are automatically created based on i18next resources present in the A3 project. They can also be imported as explained in [the following section](#4).\n\nWhen an i18n-static piece is edited, an ID is generated and stored in the `global` object. If multiple A3 instances are connected to the same database, they may not see the latest ID until the next request. When the global one changes, they will detect it and add the missing resource to i18next.\n\n\u003ca id=\"4\"\u003e\u003c/a\u003e\n\n## 4 Import and export [\u0026#x2B06;](#contents)\n\nIt is possible to import and export pieces through existing A3 modules: `npm i @apostrophecms/piece-type-exporter @apostrophecms/piece-type-importer`\n\nThese options must be added to the module's options at project level:\n\n```js\n  // in app.js\n  modules: {\n    ...\n    '@apostrophecms/piece-type-exporter': {},\n    '@apostrophecms/piece-type-importer': {},\n    '@apostrophecms/i18n-static': {\n      options: {\n        export: true,\n        import: true\n      }\n    }\n  }\n```\n\nThe import feature is then available in the manager modal: ![](import.jpg)\n\nAs the [piece-type-importer plugin](https://github.com/apostrophecms/piece-type-importer) is used, the CSV file used for import must include column names that match exactly the field names (optional empty column names can be excluded).\n\nExample of a CSV:\n\n```\ntitle,namespace,valueSingular,valuePlural,valueZero\ntest 1,default,test singular,test plural,test zero\ntest 2,apostrophe,test,,\n```\n\nPieces can also be updated with the update feature from the plugin, [as explained here](https://github.com/apostrophecms/piece-type-importer#updating-existing-pieces).\n\nThe export feature is available in the context menu when items are selected for import. ![](export.jpg)\n\n[The piece-type-exporter plugin](https://github.com/apostrophecms/piece-type-exporter) is used, so it will generate a CSV file following the same type of structure used for the importer plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fi18n-static","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fi18n-static","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fi18n-static/lists"}