Skip to content

fix(i18n): sync config-flow translations with code, drop orphaned string#47

Open
jgus wants to merge 1 commit into
sjmotew:masterfrom
jgus:fix/config-flow-translations
Open

fix(i18n): sync config-flow translations with code, drop orphaned string#47
jgus wants to merge 1 commit into
sjmotew:masterfrom
jgus:fix/config-flow-translations

Conversation

@jgus

@jgus jgus commented Jun 14, 2026

Copy link
Copy Markdown

Summary

The config flow's model selector wasn't translated, and strings.json carried a
leftover translation key for an entity that doesn't exist. This aligns the
translation files with the code.

Changes

  • translations/en.json, translations/fr.json: add the missing model
    field label (Model / Modèle) for the config-flow step, and update the step
    description to match strings.json (it now mentions selecting the model).
  • strings.json: remove the orphaned entity.binary_sensor.charging key.
    The only binary sensor is docked; charging is exposed as a regular sensor
    (sensor.charging_state, translation key charging_state), so this key
    matched no entity.

Result

strings.json, translations/en.json, and translations/fr.json now share an
identical key set, and strings.json/en.json are content-identical for English
— so the model selector is labelled in both English and French, and Hassfest sees
consistent translations.

Testing

  • pytest tests/ — 168 passed.
  • JSON validated; key parity confirmed across strings/en/fr.

The config flow has a model selector (CONF_MODEL) but en/fr only translated
host+port and the step description omitted the model. Add the model label
(Model / Modèle) and align the description. Also remove the orphaned
entity.binary_sensor.charging string — the only binary sensor is 'docked'
(charging is a sensor, not a binary_sensor).
@greptile-apps

greptile-apps Bot commented Jun 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR syncs the three translation files with the integration's actual entities and config-flow schema — adding the missing model field label and removing an orphaned binary_sensor.charging key that had no corresponding entity.

  • strings.json / translations/en.json: add model: "Model" to the config-flow data block and update the step description; both files are now content-identical, satisfying Hassfest's parity check. Confirmed correct against STEP_USER_DATA_SCHEMA in config_flow.py, which declares CONF_MODEL as a required field.
  • translations/fr.json: mirrors the same structural changes with model: "Modèle" and an updated French description; the key set now matches strings.json and en.json exactly.
  • strings.json: removes entity.binary_sensor.charging — only NarwalDockedSensor (translation key docked) is registered in binary_sensor.py, so this key was indeed orphaned.

Confidence Score: 5/5

Safe to merge — all changes are translation file corrections with no runtime code affected.

The model field added to both translation files matches the CONF_MODEL key declared in config_flow.py's schema, and strings.json / en.json are now content-identical as Hassfest requires. The removed binary_sensor.charging key is confirmed orphaned — binary_sensor.py only registers NarwalDockedSensor, which uses translation key docked.

No files require special attention.

Important Files Changed

Filename Overview
custom_components/narwal/strings.json Removes orphaned binary_sensor.charging key (no corresponding entity) and adds model field label to the config-flow step, now content-identical to en.json.
custom_components/narwal/translations/en.json Adds model data label and updates step description to match strings.json; now byte-identical to strings.json as expected by Hassfest.
custom_components/narwal/translations/fr.json Adds model: "Modèle" label and updates French step description; key set now mirrors strings.json and en.json.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CF["config_flow.py\nSTEP_USER_DATA_SCHEMA"] -->|"host, port, model"| SJ["strings.json\nconfig.step.user.data\nhost / port / model ✅"]
    SJ -->|"content-identical"| EN["translations/en.json\nconfig.step.user.data\nhost / port / model ✅"]
    SJ -->|"key-identical"| FR["translations/fr.json\nconfig.step.user.data\nhost / port / Modèle ✅"]

    BP["binary_sensor.py\nNarwalDockedSensor\ntranslation_key = docked"] --> BS_DOCKED["entity.binary_sensor.docked ✅"]
    BS_CHARGING["entity.binary_sensor.charging\n(orphaned — removed)"] -. "no entity" .-> X["❌ deleted from strings.json"]

    SP["sensor.py"] --> SS_CS["entity.sensor.charging_state ✅"]
Loading

Reviews (1): Last reviewed commit: "fix(i18n): sync config-flow translations..." | Re-trigger Greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant