From db92ffdf89a0b9a0d2607f5d34c19c32a65e518a Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Mon, 25 May 2020 16:36:49 -0400 Subject: [PATCH] Clean up vizio translation strings (#35725) * further vizio string updates * fix errant find/replace --- homeassistant/components/vizio/config_flow.py | 8 ++++---- homeassistant/components/vizio/strings.json | 16 ++++++++-------- tests/components/vizio/test_config_flow.py | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/vizio/config_flow.py b/homeassistant/components/vizio/config_flow.py index 379f6c48ace..da4c7cc8b13 100644 --- a/homeassistant/components/vizio/config_flow.py +++ b/homeassistant/components/vizio/config_flow.py @@ -229,7 +229,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): user_input[CONF_DEVICE_CLASS], session=async_get_clientsession(self.hass, False), ): - errors["base"] = "cant_connect" + errors["base"] = "cannot_connect" if not errors: unique_id = await VizioAsync.get_unique_id( @@ -323,7 +323,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) return self.async_abort(reason="updated_entry") - return self.async_abort(reason="already_setup") + return self.async_abort(reason="already_configured_device") self._must_show_form = True # Store config key/value pairs that are not configurable in user step so they @@ -354,7 +354,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): continue if _host_is_same(entry.data[CONF_HOST], discovery_info[CONF_HOST]): - return self.async_abort(reason="already_setup") + return self.async_abort(reason="already_configured_device") # Set default name to discovered device name by stripping zeroconf service # (`type`) from `name` @@ -400,7 +400,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): return self.async_show_form( step_id="user", data_schema=_get_config_schema(self._data), - errors={"base": "cant_connect"}, + errors={"base": "cannot_connect"}, ) # Complete pairing process if PIN has been provided diff --git a/homeassistant/components/vizio/strings.json b/homeassistant/components/vizio/strings.json index 9cceb6c35a2..0de1a380d12 100644 --- a/homeassistant/components/vizio/strings.json +++ b/homeassistant/components/vizio/strings.json @@ -2,7 +2,7 @@ "config": { "step": { "user": { - "title": "Setup VIZIO SmartCast Device", + "title": "VIZIO SmartCast Device", "description": "An [%key:common::config_flow::data::access_token%] is only needed for TVs. If you are configuring a TV and do not have an [%key:common::config_flow::data::access_token%] yet, leave it blank to go through a pairing process.", "data": { "name": "Name", @@ -20,28 +20,28 @@ }, "pairing_complete": { "title": "Pairing Complete", - "description": "Your VIZIO SmartCast device is now connected to Home Assistant." + "description": "Your [%key:component::vizio::config::step::user::title%] is now connected to Home Assistant." }, "pairing_complete_import": { "title": "Pairing Complete", - "description": "Your VIZIO SmartCast TV is now connected to Home Assistant.\n\nYour [%key:common::config_flow::data::access_token%] is '**{access_token}**'." + "description": "Your [%key:component::vizio::config::step::user::title%] is now connected to Home Assistant.\n\nYour [%key:common::config_flow::data::access_token%] is '**{access_token}**'." } }, "error": { - "host_exists": "VIZIO device with specified host already configured.", - "name_exists": "VIZIO device with specified name already configured.", + "host_exists": "[%key:component::vizio::config::step::user::title%] with specified host already configured.", + "name_exists": "[%key:component::vizio::config::step::user::title%] with specified name already configured.", "complete_pairing_failed": "Unable to complete pairing. Ensure the PIN you provided is correct and the TV is still powered and connected to the network before resubmitting.", - "cant_connect": "[%key:common::config_flow::error::cannot_connect%]" + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" }, "abort": { - "already_setup": "This entry has already been setup.", + "already_configured_device": "[%key:common::config_flow::abort::already_configured_device%]", "updated_entry": "This entry has already been setup but the name, apps, and/or options defined in the configuration do not match the previously imported configuration, so the configuration entry has been updated accordingly." } }, "options": { "step": { "init": { - "title": "Update VIZIO SmartCast Options", + "title": "Update [%key:component::vizio::config::step::user::title%] Options", "description": "If you have a Smart TV, you can optionally filter your source list by choosing which apps to include or exclude in your source list.", "data": { "volume_step": "Volume Step Size", diff --git a/tests/components/vizio/test_config_flow.py b/tests/components/vizio/test_config_flow.py index 0c057ba1a71..2b1908dc770 100644 --- a/tests/components/vizio/test_config_flow.py +++ b/tests/components/vizio/test_config_flow.py @@ -316,7 +316,7 @@ async def test_user_error_on_could_not_connect( ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM - assert result["errors"] == {"base": "cant_connect"} + assert result["errors"] == {"base": "cannot_connect"} async def test_user_tv_pairing_no_apps( @@ -363,7 +363,7 @@ async def test_user_start_pairing_failure( assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" - assert result["errors"] == {"base": "cant_connect"} + assert result["errors"] == {"base": "cannot_connect"} async def test_user_invalid_pin( @@ -471,7 +471,7 @@ async def test_import_entity_already_configured( ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_setup" + assert result["reason"] == "already_configured_device" async def test_import_flow_update_options( @@ -778,7 +778,7 @@ async def test_zeroconf_flow_already_configured( # Flow should abort because device is already setup assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_setup" + assert result["reason"] == "already_configured_device" async def test_zeroconf_dupe_fail(