Add French (fr) translation and make entity names/states translatable#3
Open
ADNPolymerase wants to merge 6 commits into
Open
Add French (fr) translation and make entity names/states translatable#3ADNPolymerase wants to merge 6 commits into
ADNPolymerase wants to merge 6 commits into
Conversation
- Replace hardcoded Polish _attr_name with translation_key on the calendar, RTK map camera and RTK position device_tracker entities - Add the missing device_tracker translation section (en/pl/fr) - Convert status, error, mowing_readiness, cloud_connection and maintenance_status to enum sensors that emit canonical state keys, with localized labels in translations/*.json (Polish wording preserved) - Replace remaining hardcoded Polish in the free-text schedule summary and day labels with neutral English (HA cannot translate free text)
- Rename the select to a shorter 'Mowing zone' / 'Zone de tonte' / 'Mähzone' - Localize the dynamically built zone option labels (all zones / Zone N / Zones N, M) from the HA UI language instead of hard-coded Polish; Polish wording preserved, unknown languages fall back to English
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a complete French (
fr) translation and routes everything through Home Assistant's native i18n, soen,plandfrall work. Several strings were previously hard-coded Polish in the Python code, bypassing the translation files — those are fixed here too.This PR is self-contained (it also adds
translations/fr.json).What changed
1. French translation
translations/fr.jsonmirroringen.json/pl.json(identical key structure).2. Entity names that ignored translations
Three entities used a hard-coded Polish
_attr_name, which overridestranslation_key:_attr_name = "Harmonogram koszenia"_attr_translation_key = "schedule"_attr_name = "Mapa RTK"_attr_translation_key = "rtk_map_camera"_attr_name = "Pozycja RTK"_attr_translation_key = "rtk_position"Added the missing
device_tracker.rtk_positionname toen/pl/fr.3. Sensor states that were hard-coded Polish
status,errorandmowing_readinessmapped raw Worx descriptions to Polish strings via in-code dicts (STATUS_LABELS_PL/READINESS_LABELS_PL). These are now enum sensors (SensorDeviceClass.ENUM) emitting canonical keys (home,mowing,going_home, …), with labels moved totranslations/*.jsonunder each sensor'sstate. The exact previous Polish wording is preserved inpl.json.Also enum-ified
cloud_connection(ok/check/offline) andmaintenance_status(ok/blade_service_due/battery_service_due), which previously emitted raw English keys with no localization.4. Free-text schedule summary
The
schedulesensor builds a free-form string ("brak aktywnych slotow","+ krawedz", Polish day abbreviations). HA cannot translate arbitrary state text, so the hard-coded Polish was replaced with neutral English. Structured data remains available via the sensor's attributes and the calendar entity for localized dashboards.koszenie→mowing, displayed via translations). Automations/templates that compared the raw Polish text must compare the canonical key instead. This is the standard HA enum approach required for multi-language support.errordescriptions now yield an empty enum state; the original text is still exposed via the sensor'sraw_descriptionattribute.Validation
en.json/pl.json/fr.jsonhave identical key structure (221 keys each), valid JSON.python -m py_compilepasses on all modified modules.