Add Translation Management section for admin UI translation synchronization - #81
Add Translation Management section for admin UI translation synchronization#81DutchmanNL with Copilot wants to merge 4 commits into
Conversation
…#65) Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
…generic Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds new template guidance to help ioBroker adapter maintainers keep JSON-Config admin UI translation files synchronized with admin/jsonConfig.json, and bumps the template/package version to 0.6.0.
Changes:
- Added a “Translation Management” section (workflow + validation script example) to
template.md. - Bumped version references to
0.6.0across template, package, metadata, README, and repo instructions. - Added
0.6.0changelog entries describing the translation-management addition.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| template.md | Adds Translation Management guidance, validation script example, and workflow/checklist for i18n key synchronization. |
| package.json | Bumps package version to 0.6.0. |
| config/metadata.json | Bumps main and template version to 0.6.0. |
| README.md | Updates the displayed template version snippet to 0.6.0. |
| CHANGELOG.md | Adds a 0.6.0 section documenting the translation-management change. |
| .github/copilot-instructions.md | Bumps repository instructions version to 0.6.0. |
| if (typeof obj === 'object' && obj !== null) { | ||
| if (obj.label) texts.add(obj.label); | ||
| if (obj.help) texts.add(obj.help); | ||
| for (const key in obj) { | ||
| extractTexts(obj[key], texts); |
There was a problem hiding this comment.
The validation script example adds obj.label / obj.help values to the Set without checking they are strings. In JSON-Config these fields can be language objects (or other non-string values), which would lead to incorrect keys (e.g., objects) and false missing/orphaned reports. Consider only collecting string values (or explicitly handling { en: ... } forms) before adding them to the set.
| if (typeof obj === 'object' && obj !== null) { | |
| if (obj.label) texts.add(obj.label); | |
| if (obj.help) texts.add(obj.help); | |
| for (const key in obj) { | |
| extractTexts(obj[key], texts); | |
| if (obj && typeof obj === 'object') { | |
| const collectTextValue = (value) => { | |
| if (typeof value === 'string') { | |
| texts.add(value); | |
| } else if (value && typeof value === 'object') { | |
| // Handle language objects like { "en": "Name", "de": "Name" } | |
| if (typeof value.en === 'string') { | |
| texts.add(value.en); | |
| } | |
| for (const v of Object.values(value)) { | |
| if (typeof v === 'string') { | |
| texts.add(v); | |
| } | |
| } | |
| } | |
| }; | |
| if (obj.label) collectTextValue(obj.label); | |
| if (obj.help) collectTextValue(obj.help); | |
| for (const key in obj) { | |
| if (Object.prototype.hasOwnProperty.call(obj, key)) { | |
| extractTexts(obj[key], texts); | |
| } |
| - **Location**: `admin/i18n/{lang}/translations.json` for 11 languages (de, en, es, fr, it, nl, pl, pt, ru, uk, zh-cn) | ||
| - **Source of truth**: `admin/jsonConfig.json` - all `label` and `help` properties must have translations | ||
| - **Command**: `npm run translate` - automatically generates translations but does NOT remove orphaned keys | ||
| - **Formatting**: English uses tabs, other languages use 4 spaces (per ioBroker standards) |
There was a problem hiding this comment.
The statement about JSON formatting (“English uses tabs, other languages use 4 spaces”) is likely inaccurate/misleading since JSON whitespace is not semantically relevant and formatting depends on the tool/editor. Suggest removing this rule or rephrasing it to a tool-agnostic recommendation (e.g., run formatter/keep consistent formatting).
| - **Formatting**: English uses tabs, other languages use 4 spaces (per ioBroker standards) | |
| - **Formatting**: Use a consistent JSON formatting/indentation style across all languages (preferably via your project’s formatter or editor’s JSON format command). |
| ## [0.6.0] - 2026-02-16 | ||
| - (copilot) **NEW**: Added comprehensive Translation Management section to template.md with detailed instructions for keeping translation files synchronized with admin/jsonConfig.json (Fixes #65) |
There was a problem hiding this comment.
|
rebuild PR in #83 |
ioBroker adapters with JSON-Config admin interfaces require translation files in 11 languages to stay synchronized with
admin/jsonConfig.json. The automatednpm run translatecommand adds new keys but doesn't remove orphaned ones, leading to recurring PR review issues.Changes
Translation Management section in template.md
Version bump to 0.6.0
Validation Script Example
The script identifies discrepancies between jsonConfig.json and translation files, preventing the "10+ review comments" scenario documented from ioBroker.bambulab PR #248.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.