From 9acc7345a8b66d8b733a6d9d85d9867070c4b29f Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sat, 26 Oct 2019 19:29:24 +0200 Subject: [PATCH] Add translation support --- .../georide/.translations/en.json | 23 +++++++++++++++++++ custom_components/georide/__init__.py | 3 ++- custom_components/georide/config_flow.py | 4 ++-- custom_components/georide/const.py | 1 - 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 custom_components/georide/.translations/en.json diff --git a/custom_components/georide/.translations/en.json b/custom_components/georide/.translations/en.json new file mode 100644 index 0000000..4bae62f --- /dev/null +++ b/custom_components/georide/.translations/en.json @@ -0,0 +1,23 @@ +{ + "config": { + "title": "Georide", + "step": { + "user": { + "title": "Set up Georide", + "description": "Are you sure you want to set up Georide?", + "data": { + "email": "email", + "password": "password" + } + } + }, + "abort": { + "one_instance_allowed": "Only a single instance is allowed.", + "no_credential": "You need to add your credentails." + + }, + "create_entry": { + "default": "\n\nJust give your credentials" + } + } +} \ No newline at end of file diff --git a/custom_components/georide/__init__.py b/custom_components/georide/__init__.py index 5394880..412e74f 100644 --- a/custom_components/georide/__init__.py +++ b/custom_components/georide/__init__.py @@ -14,12 +14,12 @@ import homeassistant.helpers.config_validation as cv from homeassistant.setup import async_when_setup from .const import ( - DOMAIN, CONF_EMAIL, CONF_PASSWORD, TRACKER_ID ) +DOMAIN = "georide" _LOGGER = logging.getLogger(__name__) @@ -63,6 +63,7 @@ async def async_setup_entry(hass, entry): password ) hass.data[DOMAIN]["context"] = context + """ hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "device_tracker") ) """ return True diff --git a/custom_components/georide/config_flow.py b/custom_components/georide/config_flow.py index 4d413b1..f104da3 100644 --- a/custom_components/georide/config_flow.py +++ b/custom_components/georide/config_flow.py @@ -5,14 +5,14 @@ from homeassistant import config_entries import voluptuous as vol -from .const import DOMAIN, CONF_EMAIL, CONF_PASSWORD +from .const import CONF_EMAIL, CONF_PASSWORD _LOGGER = logging.getLogger(__name__) STEP_ID = 'user' -@config_entries.HANDLERS.register(DOMAIN) +@config_entries.HANDLERS.register("georide") class GeorideConfigFlow(config_entries.ConfigFlow): """Georide config flow """ diff --git a/custom_components/georide/const.py b/custom_components/georide/const.py index 2a5b44e..81a1586 100644 --- a/custom_components/georide/const.py +++ b/custom_components/georide/const.py @@ -1,6 +1,5 @@ """ Georide const file """ -DOMAIN = "georide" CONF_EMAIL = "email" CONF_PASSWORD = "password"