Rename translations dir for integrations (#34494)

This commit is contained in:
Joakim Sørensen authored and GitHub committed 2020-04-21 16:11:05 -07:00
1 parent d06fce6997
commit 730a257f3c
5208 files changed
+55 -25

No files matched your search

+22
View File
@@ -29,6 +29,25 @@ REMOVED_TITLE_MSG = (
"manifest."
)
MOVED_TRANSLATIONS_DIRECTORY_MSG = (
"The '.translations' directory has been moved, the new name is 'translations', "
"starting with Home Assistant 0.111 your translations will no longer "
"load if you do not move/rename this "
)
def check_translations_directory_name(integration: Integration) -> None:
"""Check that the correct name is used for the translations directory."""
legacy_translations = integration.path / ".translations"
translations = integration.path / "translations"
if translations.is_dir():
# No action required
return
if legacy_translations.is_dir():
integration.add_warning("translations", MOVED_TRANSLATIONS_DIRECTORY_MSG)
def find_references(strings, prefix, found):
"""Find references."""
@@ -188,6 +207,9 @@ ONBOARDING_SCHEMA = vol.Schema({vol.Required("area"): {str: str}})
def validate_translation_file(config: Config, integration: Integration, all_strings):
"""Validate translation files for integration."""
if config.specific_integrations:
check_translations_directory_name(integration)
strings_file = integration.path / "strings.json"
references = []