Rename translations dir for integrations (#34494)

This commit is contained in:
Joakim Sørensen
2020-04-22 01:11:05 +02:00
committed by GitHub
parent d06fce6997
commit 730a257f3c
5208 changed files with 55 additions and 25 deletions

View File

@@ -41,7 +41,7 @@ def find_core():
if not strings.is_file():
continue
translations = int_dir / ".translations" / "en.json"
translations = int_dir / "translations" / "en.json"
strings_json = json.loads(strings.read_text())
translations_json = json.loads(translations.read_text())

View File

@@ -39,7 +39,7 @@ def run_download_docker():
"json",
"--unzip_to",
"/opt/dest",
],
]
)
print()
@@ -78,12 +78,9 @@ def get_component_path(lang, component):
"""Get the component translation path."""
if os.path.isdir(os.path.join("homeassistant", "components", component)):
return os.path.join(
"homeassistant", "components", component, ".translations", f"{lang}.json"
)
else:
return os.path.join(
"homeassistant", "components", ".translations", f"{component}.{lang}.json"
"homeassistant", "components", component, "translations", f"{lang}.json"
)
raise ExitApp(f"Integration {component} not found under homeassistant/components/")
def get_platform_path(lang, component, platform):
@@ -94,7 +91,7 @@ def get_platform_path(lang, component, platform):
"components",
component,
platform,
".translations",
"translations",
f"{lang}.json",
)
else:
@@ -102,7 +99,7 @@ def get_platform_path(lang, component, platform):
"homeassistant",
"components",
component,
".translations",
"translations",
f"{platform}.{lang}.json",
)