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 <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
pull/71012/head^2
Franck Nijhof 2022-04-28 17:31:11 +02:00 committed by GitHub
parent ac044c8ffa
commit 7fbc3f6364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -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)