diff --git a/custom_components/localthings/registry/capabilities/laundry.py b/custom_components/localthings/registry/capabilities/laundry.py index b578ed2..4205802 100644 --- a/custom_components/localthings/registry/capabilities/laundry.py +++ b/custom_components/localthings/registry/capabilities/laundry.py @@ -20,7 +20,6 @@ Door-LED keys use NO `x.com.samsung.da.` prefix -- `setBrightness` / `setNightLight` -- preserved exactly as they appear in the OCF resource rep. """ -import string from datetime import UTC, datetime from datetime import time as dt_time @@ -358,14 +357,15 @@ def personal_course_labels(resources, href="/wm/personalcourse/vs/0"): def washer_cycle_fallback(value, resources): - """Label an untranslated washer course without guessing its meaning.""" + """Label a personal washer course from its device-provided name. + + No fallback for an unrecognized standard code -- an invented English + label would defeat translation (PR #251 review); the raw code displays + instead, same as before this function existed. + """ if not isinstance(value, str): return None - if label := personal_course_labels(resources).get(value.upper()): - return label - if len(value) == 2 and all(char in string.hexdigits for char in value): - return f"Unknown (0x{value.upper()})" - return None + return personal_course_labels(resources).get(value.upper()) def _table_id(resources, table_href): diff --git a/custom_components/localthings/registry/capabilities/washer.py b/custom_components/localthings/registry/capabilities/washer.py index f948736..4e3f910 100644 --- a/custom_components/localthings/registry/capabilities/washer.py +++ b/custom_components/localthings/registry/capabilities/washer.py @@ -54,9 +54,10 @@ from .laundry import ( # # The owner of a Korean Table_02 washer confirmed the names for its newer # 69/6A-79/88 course-code family, including Course_69 as AI Wash. Those names -# live only in the table-scoped translation catalog; codes not confirmed by -# the owner or device metadata continue to use the safe unknown-code fallback, -# via washer_cycle_fallback (personal-course names, then 'Unknown (0xNN)'). +# live only in the table-scoped translation catalog; a code not confirmed by +# the owner or device metadata falls back to washer_cycle_fallback, which +# surfaces a personal-course name only -- no invented English label for an +# unrecognized standard code (PR #251 review). # --------------------------------------------------------------------------- # /washer/vs/0 -- wash temperature, spin speed, rinse cycle count. diff --git a/custom_components/localthings/translations/de.json b/custom_components/localthings/translations/de.json index 18c13a1..910e2d8 100644 --- a/custom_components/localthings/translations/de.json +++ b/custom_components/localthings/translations/de.json @@ -107,7 +107,7 @@ "name": "Ausgabe läuft" }, "remote_control": { - "name": "Smart Control" + "name": "Intelligente Steuerung" } }, "button": { @@ -150,7 +150,7 @@ "motiondirect": "Bewegung direkt", "drycomfort": "Trockenkomfort", "2step": "2-Stufen", - "smart": "Smart", + "smart": "Intelligent", "nano": "WindFree", "sleep": "Schlaf", "dlightcool": "d'light Cool" @@ -172,7 +172,7 @@ "state": { "mid": "Mittel", "sleep": "Schlaf", - "smart": "Smart", + "smart": "Intelligent", "max": "Max", "windfree": "WindFree" } @@ -702,7 +702,7 @@ "edge_lighting_mode": { "name": "Randbeleuchtungsmodus", "state": { - "smart": "Smart", + "smart": "Intelligent", "high": "Hoch", "low": "Niedrig" } @@ -718,7 +718,7 @@ "indicator_light_mode": { "name": "Kontrollleuchtenmodus", "state": { - "smart": "Smart", + "smart": "Intelligent", "high": "Hoch", "low": "Niedrig" } diff --git a/custom_components/localthings/translations/nl.json b/custom_components/localthings/translations/nl.json index 72c3a99..c135796 100644 --- a/custom_components/localthings/translations/nl.json +++ b/custom_components/localthings/translations/nl.json @@ -632,7 +632,7 @@ "60": "Self Clean+", "65": "Bonte was", "66": "Spijkergoed", - "69": "AI Wash", + "69": "AI wassen", "6a": "Wol", "6b": "Spijkergoed", "6c": "Blouses", @@ -655,7 +655,7 @@ "7f": "Wol/fijne was", "86": "Diep wassen", "87": "Gedownload", - "88": "Pet Care", + "88": "Huisdierverzorging", "8f": "Intensief koud", "96": "Minder microvezels", "35": "Eco katoen" diff --git a/tests/test_laundry_capabilities.py b/tests/test_laundry_capabilities.py index 26b5c86..2934d6c 100644 --- a/tests/test_laundry_capabilities.py +++ b/tests/test_laundry_capabilities.py @@ -95,7 +95,8 @@ class TestCourseHelpers: } assert laundry.personal_course_labels(resources) == {} - def test_washer_cycle_fallback_uses_labels_then_safe_unknown_text(self): + def test_washer_cycle_fallback_only_labels_personal_courses(self): + """No invented English label for an unrecognized code (PR #251 review).""" resources = { "/wm/personalcourse/vs/0": { "x.com.samsung.da.courses": ["F1_0106EC868DEC98B7"], @@ -103,8 +104,8 @@ class TestCourseHelpers: } expected = bytes.fromhex("EC868DEC98B7").decode("utf-8") assert laundry.washer_cycle_fallback("F1", resources) == expected - assert laundry.washer_cycle_fallback("69", resources) == "Unknown (0x69)" - assert laundry.washer_cycle_fallback("6f", resources) == "Unknown (0x6F)" + assert laundry.washer_cycle_fallback("69", resources) is None + assert laundry.washer_cycle_fallback("6f", resources) is None assert laundry.washer_cycle_fallback("Normal", resources) is None diff --git a/tests/test_translations.py b/tests/test_translations.py index 2cd2ae2..a456e51 100644 --- a/tests/test_translations.py +++ b/tests/test_translations.py @@ -237,7 +237,7 @@ def test_confirmed_course_names_are_localized(): }, "nl": { "washer": ( - "AI Wash", + "AI wassen", "Wol", "Spijkergoed", "Blouses", @@ -254,7 +254,7 @@ def test_confirmed_course_names_are_localized(): "Katoen", "Spoelen + centrifugeren", "Alleen centrifugeren", - "Pet Care", + "Huisdierverzorging", ), "dishwasher": ( "Auto",