Skip to content

fix: translate app tag arrays - #676

Open
jeroenwienk wants to merge 1 commit into
developfrom
codex/fix-translate-tag-arrays
Open

jeroenwienk wants to merge 1 commit into
developfrom
codex/fix-translate-tag-arrays

Conversation

@jeroenwienk

Copy link
Copy Markdown
Contributor

Problem

Running homey app translate --languages nl on a manifest containing "tags": { "en": ["heating", "lighting"] } throws TypeError: text.match is not a function. The translator treats the English array as a single string, preventing all translation changes in that file from being saved.

Change

Recognize English strings and arrays of strings as translation sources. Translate array entries individually and preserve their order and array structure, so missing tag translations and surrounding manifest fields can be saved. Existing translations remain intact, and empty arrays require no API requests. Other English value types are skipped while nested translation objects remain discoverable.

Validation

  • node --test tests/app/translate.test.mjs — all 10 tests pass. Three new regression tests failed before the fix and pass afterward; they cover tag arrays, surrounding fields, existing translations, repeat runs, empty arrays, and unsupported source values.
  • npm run lint — passes.
  • git diff --check — passes.

Translation responses are mocked in the tests; no live API calls were made.

@jeroenwienk
jeroenwienk requested a balanced review from Copilot September 15, 2026 12:12
@jeroenwienk
jeroenwienk marked this pull request as ready for review September 15, 2026 12:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation handles the reported failure and is adequately covered by regression tests.

Pull request overview

Adds array-aware manifest translation while preserving existing translations and nested discovery.

Changes:

  • Translates English string-array entries individually.
  • Skips unsupported source types and avoids API calls for empty arrays.
  • Adds regression coverage for arrays, repeat runs, and surrounding fields.
File summaries
File Description
lib/app/Translate.js Supports string arrays as translation sources.
tests/app/translate.test.mjs Adds array translation regression tests.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants