mirror of
https://github.com/home-assistant/core.git
synced 2025-04-28 11:17:53 +00:00
Remove loading of legacy translations (#37021)
This commit is contained in:
parent
9d16edc1dc
commit
835f433cf7
@ -20,12 +20,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
TRANSLATION_LOAD_LOCK = "translation_load_lock"
|
TRANSLATION_LOAD_LOCK = "translation_load_lock"
|
||||||
TRANSLATION_FLATTEN_CACHE = "translation_flatten_cache"
|
TRANSLATION_FLATTEN_CACHE = "translation_flatten_cache"
|
||||||
|
|
||||||
MOVED_TRANSLATIONS_DIRECTORY_MSG = (
|
|
||||||
"%s: 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 recursive_flatten(prefix: Any, data: Dict) -> Dict[str, Any]:
|
def recursive_flatten(prefix: Any, data: Dict) -> Dict[str, Any]:
|
||||||
"""Return a flattened representation of dict data."""
|
"""Return a flattened representation of dict data."""
|
||||||
@ -71,13 +65,8 @@ def component_translation_path(
|
|||||||
else:
|
else:
|
||||||
filename = f"{language}.json"
|
filename = f"{language}.json"
|
||||||
|
|
||||||
translation_legacy_path = integration.file_path / ".translations"
|
|
||||||
translation_path = integration.file_path / "translations"
|
translation_path = integration.file_path / "translations"
|
||||||
|
|
||||||
if translation_legacy_path.is_dir() and not translation_path.is_dir():
|
|
||||||
_LOGGER.warning(MOVED_TRANSLATIONS_DIRECTORY_MSG, domain)
|
|
||||||
return str(translation_legacy_path / filename)
|
|
||||||
|
|
||||||
return str(translation_path / filename)
|
return str(translation_path / filename)
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ REMOVED_TITLE_MSG = (
|
|||||||
|
|
||||||
MOVED_TRANSLATIONS_DIRECTORY_MSG = (
|
MOVED_TRANSLATIONS_DIRECTORY_MSG = (
|
||||||
"The '.translations' directory has been moved, the new name is 'translations', "
|
"The '.translations' directory has been moved, the new name is 'translations', "
|
||||||
"starting with Home Assistant 0.111 your translations will no longer "
|
"starting with Home Assistant 0.112 your translations will no longer "
|
||||||
"load if you do not move/rename this "
|
"load if you do not move/rename this "
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def check_translations_directory_name(integration: Integration) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if legacy_translations.is_dir():
|
if legacy_translations.is_dir():
|
||||||
integration.add_warning("translations", MOVED_TRANSLATIONS_DIRECTORY_MSG)
|
integration.add_error("translations", MOVED_TRANSLATIONS_DIRECTORY_MSG)
|
||||||
|
|
||||||
|
|
||||||
def find_references(strings, prefix, found):
|
def find_references(strings, prefix, found):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user