From 7fbc3f63643c314d8c8097e6fd4bc9a1b2314dc2 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 28 Apr 2022 17:31:11 +0200 Subject: [PATCH] Skip translations when integration no longer exists (#71004) * Skip translations when integration no longer exists * Update script/translations/download.py Co-authored-by: Martin Hjelmare Co-authored-by: Martin Hjelmare --- script/translations/download.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script/translations/download.py b/script/translations/download.py index eab9c40370e..6d4ce91263a 100755 --- a/script/translations/download.py +++ b/script/translations/download.py @@ -70,7 +70,7 @@ def get_component_path(lang, component): return os.path.join( "homeassistant", "components", component, "translations", f"{lang}.json" ) - raise ExitApp(f"Integration {component} not found under homeassistant/components/") + return None def get_platform_path(lang, component, platform): @@ -98,7 +98,11 @@ def save_language_translations(lang, translations): for component, component_translations in components.items(): base_translations = get_component_translations(component_translations) if base_translations: - path = get_component_path(lang, component) + if (path := get_component_path(lang, component)) is None: + print( + f"Skipping {lang} for {component}, as the integration doesn't seem to exist." + ) + continue os.makedirs(os.path.dirname(path), exist_ok=True) save_json(path, base_translations)