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
parent
ac044c8ffa
commit
7fbc3f6364
|
@ -70,7 +70,7 @@ def get_component_path(lang, component):
|
||||||
return os.path.join(
|
return os.path.join(
|
||||||
"homeassistant", "components", component, "translations", f"{lang}.json"
|
"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):
|
def get_platform_path(lang, component, platform):
|
||||||
|
@ -98,7 +98,11 @@ def save_language_translations(lang, translations):
|
||||||
for component, component_translations in components.items():
|
for component, component_translations in components.items():
|
||||||
base_translations = get_component_translations(component_translations)
|
base_translations = get_component_translations(component_translations)
|
||||||
if base_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)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
save_json(path, base_translations)
|
save_json(path, base_translations)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue