Created
January 14, 2019 23:18
-
-
Save dgomes/fbcf1c14d7fc23d63e490ca7168b7d74 to your computer and use it in GitHub Desktop.
Possible patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/homeassistant/helpers/translation.py | |
+++ b/homeassistant/helpers/translation.py | |
@@ -4,7 +4,7 @@ from os import path | |
from typing import Any, Dict, Iterable | |
from homeassistant import config_entries | |
-from homeassistant.loader import get_component, bind_hass | |
+from homeassistant.loader import get_component, get_platform, bind_hass | |
from homeassistant.util.json import load_json | |
from .typing import HomeAssistantType | |
@@ -34,11 +34,12 @@ def component_translation_file(hass: HomeAssistantType, component: str, | |
language: str) -> str: | |
"""Return the translation json file location for a component.""" | |
if '.' in component: | |
- name = component.split('.', 1)[1] | |
+ domain, name = component.split('.', 1) | |
+ module = get_platform(hass, domain=domain, platform_name=name) | |
else: | |
name = component | |
+ module = get_component(hass, component) | |
- module = get_component(hass, component) | |
assert module is not None | |
component_path = path.dirname(module.__file__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment