diff --git a/homeassistant/components/adguard/strings.json b/homeassistant/components/adguard/strings.json index 471708879b4..f5f780c70b5 100644 --- a/homeassistant/components/adguard/strings.json +++ b/homeassistant/components/adguard/strings.json @@ -4,10 +4,10 @@ "user": { "description": "Set up your AdGuard Home instance to allow monitoring and control.", "data": { - "host": "Host", - "password": "Password", - "port": "Port", - "username": "Username", + "host": "[%key:common::config_flow::data::host%]", + "password": "[%key:common::config_flow::data::password%]", + "port": "[%key:common::config_flow::data::port%]", + "username": "[%key:common::config_flow::data::username%]", "ssl": "AdGuard Home uses a SSL certificate", "verify_ssl": "AdGuard Home uses a proper certificate" } diff --git a/homeassistant/components/airvisual/strings.json b/homeassistant/components/airvisual/strings.json index 8b9978b611f..07c27c01a91 100644 --- a/homeassistant/components/airvisual/strings.json +++ b/homeassistant/components/airvisual/strings.json @@ -5,7 +5,7 @@ "title": "Configure a Geography", "description": "Use the AirVisual cloud API to monitor a geographical location.", "data": { - "api_key": "API Key", + "api_key": "[%key:common::config_flow::data::api_key%]", "latitude": "Latitude", "longitude": "Longitude" } diff --git a/homeassistant/components/doorbird/strings.json b/homeassistant/components/doorbird/strings.json index e27083d2e09..2fc7cf5beef 100644 --- a/homeassistant/components/doorbird/strings.json +++ b/homeassistant/components/doorbird/strings.json @@ -12,10 +12,10 @@ "user": { "title": "Connect to the DoorBird", "data": { - "password": "Password", + "password": "[%key:common::config_flow::data::password%]", "host": "Host (IP Address)", "name": "Device Name", - "username": "Username" + "username": "[%key:common::config_flow::data::username%]" } } }, @@ -26,9 +26,9 @@ }, "flow_title": "DoorBird {name} ({host})", "error": { - "invalid_auth": "Invalid authentication", - "unknown": "Unexpected error", - "cannot_connect": "Failed to connect, please try again" + "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "unknown": "[%key:common::config_flow::error::unknown%]", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" } } } diff --git a/homeassistant/components/garmin_connect/strings.json b/homeassistant/components/garmin_connect/strings.json index 1f14d91e04a..a68a505613a 100644 --- a/homeassistant/components/garmin_connect/strings.json +++ b/homeassistant/components/garmin_connect/strings.json @@ -1,6 +1,8 @@ { "config": { - "abort": { "already_configured": "This account is already configured." }, + "abort": { + "already_configured": "[%key:common::config_flow::abort::already_configured_account%]" + }, "error": { "cannot_connect": "Failed to connect, please try again.", "invalid_auth": "Invalid authentication.", diff --git a/homeassistant/components/life360/strings.json b/homeassistant/components/life360/strings.json index 22d3f52c63b..a4f4cdfed95 100644 --- a/homeassistant/components/life360/strings.json +++ b/homeassistant/components/life360/strings.json @@ -10,7 +10,7 @@ "error": { "invalid_username": "Invalid username", "invalid_credentials": "Invalid credentials", - "user_already_configured": "Account has already been configured", + "user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]", "unexpected": "Unexpected error communicating with Life360 server" }, "create_entry": { @@ -18,7 +18,7 @@ }, "abort": { "invalid_credentials": "Invalid credentials", - "user_already_configured": "Account has already been configured" + "user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]" } } } diff --git a/homeassistant/components/netatmo/strings.json b/homeassistant/components/netatmo/strings.json index e25ca1e5849..2d41f560cff 100644 --- a/homeassistant/components/netatmo/strings.json +++ b/homeassistant/components/netatmo/strings.json @@ -1,13 +1,17 @@ { "config": { "step": { - "pick_implementation": { "title": "Pick Authentication Method" } + "pick_implementation": { + "title": "[%key:common::config_flow::title::oauth2_pick_implementation%]" + } }, "abort": { - "already_setup": "You can only configure one Netatmo account.", - "authorize_url_timeout": "Timeout generating authorize url.", - "missing_configuration": "The Netatmo component is not configured. Please follow the documentation." + "already_setup": "[%key:common::config_flow::abort::single_instance_allowed%]", + "authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]", + "missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]" }, - "create_entry": { "default": "Successfully authenticated with Netatmo." } + "create_entry": { + "default": "[%key:common::config_flow::create_entry::authenticated%]" + } } } diff --git a/homeassistant/components/smartthings/strings.json b/homeassistant/components/smartthings/strings.json index c8b938ebc6a..3b8e3b208a6 100644 --- a/homeassistant/components/smartthings/strings.json +++ b/homeassistant/components/smartthings/strings.json @@ -8,7 +8,9 @@ "pat": { "title": "Enter Personal Access Token", "description": "Please enter a SmartThings [Personal Access Token]({token_url}) that has been created per the [instructions]({component_url}). This will be used to create the Home Assistant integration within your SmartThings account.", - "data": { "access_token": "Access Token" } + "data": { + "access_token": "[%key:common::config_flow::data::access_token%]" + } }, "select_location": { "title": "Select Location", diff --git a/homeassistant/components/tibber/strings.json b/homeassistant/components/tibber/strings.json index a856c96e2f9..483e7a28fcc 100644 --- a/homeassistant/components/tibber/strings.json +++ b/homeassistant/components/tibber/strings.json @@ -7,7 +7,7 @@ "error": { "timeout": "Timeout connecting to Tibber", "connection_error": "Error connecting to Tibber", - "invalid_access_token": "Invalid access token" + "invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]" }, "step": { "user": { @@ -19,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/homeassistant/components/xiaomi_miio/strings.json b/homeassistant/components/xiaomi_miio/strings.json index 1562bbb6526..0040e6fdb75 100644 --- a/homeassistant/components/xiaomi_miio/strings.json +++ b/homeassistant/components/xiaomi_miio/strings.json @@ -19,11 +19,11 @@ } }, "error": { - "connect_error": "Failed to connect, please try again", + "connect_error": "[%key:common::config_flow::error::cannot_connect%]", "no_device_selected": "No device selected, please select one device." }, "abort": { - "already_configured": "Device is already configured" + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" } } } diff --git a/homeassistant/components/zha/strings.json b/homeassistant/components/zha/strings.json index 755ba7ae710..6906b5b3e8c 100644 --- a/homeassistant/components/zha/strings.json +++ b/homeassistant/components/zha/strings.json @@ -3,7 +3,10 @@ "step": { "user": { "title": "ZHA", - "data": { "radio_type": "Radio Type", "usb_path": "USB Device Path" } + "data": { + "radio_type": "Radio Type", + "usb_path": "[%key:common::config_flow::data::usb_path%]" + } } }, "error": { "cannot_connect": "Unable to connect to ZHA device." }, diff --git a/homeassistant/strings.json b/homeassistant/strings.json index 129b633fbf3..38bc4ba68b3 100644 --- a/homeassistant/strings.json +++ b/homeassistant/strings.json @@ -15,6 +15,43 @@ "paused": "Paused", "home": "Home", "not_home": "Away" + }, + "config_flow": { + "title": { + "oauth2_pick_implementation": "Pick Authentication Method", + "via_hassio_addon": "{name} via Home Assistant add-on" + }, + "description": { + "confirm_setup": "Do you want to set up {name}?" + }, + "data": { + "username": "Username", + "password": "Password", + "host": "Host", + "port": "Port", + "usb_path": "USB Device Path", + "access_token": "Access Token", + "api_key": "API Key" + }, + "create_entry": { + "authenticated": "Successfully authenticated" + }, + "error": { + "invalid_api_key": "Invalid API key", + "invalid_access_token": "Invalid access token", + "cannot_connect": "Failed to connect", + "invalid_auth": "Invalid authentication", + "unknown": "Unexpected error" + }, + "abort": { + "single_instance_allowed": "Already configured. Only a single configuration possible.", + "already_configured_account": "Account is already configured", + "already_configured_service": "Service is already configured", + "already_configured_device": "Device is already configured", + "no_devices_found": "No devices found on the network", + "oauth2_missing_configuration": "The component is not configured. Please follow the documentation.", + "oauth2_authorize_url_timeout": "Timeout generating authorize url." + } } } } diff --git a/script/scaffold/generate.py b/script/scaffold/generate.py index 4317618ed52..77317a20185 100644 --- a/script/scaffold/generate.py +++ b/script/scaffold/generate.py @@ -116,14 +116,22 @@ def _custom_tasks(template, info) -> None: title=info.name, config={ "step": { - "user": {"title": "Connect to the device", "data": {"host": "Host"}} + "user": { + "data": { + "host": "[%key:common::config_flow::data::host%]", + "username": "[%key:common::config_flow::data::username%]", + "password": "[%key:common::config_flow::data::password%]", + }, + } }, "error": { - "cannot_connect": "Failed to connect, please try again", - "invalid_auth": "Invalid authentication", - "unknown": "Unexpected error", + "cannot_connect": "[%key:common::config_flow::abort::cannot_connect%]", + "invalid_auth": "[%key:common::config_flow::abort::invalid_auth%]", + "unknown": "[%key:common::config_flow::abort::unknown%]", + }, + "abort": { + "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" }, - "abort": {"already_configured": "Device is already configured"}, }, ) @@ -133,11 +141,13 @@ def _custom_tasks(template, info) -> None: title=info.name, config={ "step": { - "confirm": {"description": f"Do you want to set up {info.name}?"} + "confirm": { + "description": "[%key:common::config_flow::description::confirm_setup%]", + } }, "abort": { - "single_instance_allowed": f"Only a single configuration of {info.name} is possible.", - "no_devices_found": f"No {info.name} devices found on the network.", + "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]", + "no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]", }, }, ) @@ -148,13 +158,16 @@ def _custom_tasks(template, info) -> None: title=info.name, config={ "step": { - "pick_implementation": {"title": "Pick Authentication Method"} + "pick_implementation": { + "title": "[%key:common::config_flow::title::oauth2_pick_implementation%]" + } }, "abort": { - "missing_configuration": "The {info.name} component is not configured. Please follow the documentation." + "missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]", + "authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]", }, "create_entry": { - "default": f"Successfully authenticated with {info.name}." + "default": "[%key:common::config_flow::create_entry::authenticated%]" }, }, ) diff --git a/script/translations/migrate.py b/script/translations/migrate.py index 8081a442955..9b0fce4765e 100644 --- a/script/translations/migrate.py +++ b/script/translations/migrate.py @@ -327,12 +327,25 @@ def find_frontend_states(): def run(): """Migrate translations.""" # Import new common keys - migrate_project_keys_translations( + rename_keys( CORE_PROJECT_ID, - FRONTEND_PROJECT_ID, { - "common::state::off": "state::default::off", - "common::state::on": "state::default::on", + "component::netatmo::config::step::pick_implementation::title": "common::config_flow::title::oauth2_pick_implementation", + "component::doorbird::config::step::user::data::username": "common::config_flow::data::username", + "component::doorbird::config::step::user::data::password": "common::config_flow::data::password", + "component::adguard::config::step::user::data::host": "common::config_flow::data::host", + "component::adguard::config::step::user::data::port": "common::config_flow::data::port", + "component::zha::config::step::user::data::usb_path": "common::config_flow::data::usb_path", + "component::smartthings::config::step::pat::data::access_token": "common::config_flow::data::access_token", + "component::airvisual::config::step::geography::data::api_key": "common::config_flow::data::api_key", + "component::doorbird::config::error::invalid_auth": "common::config_flow::error::invalid_auth", + "component::airvisual::config::error::invalid_api_key": "common::config_flow::error::invalid_api_key", + "component::tibber::config::error::invalid_access_token": "common::config_flow::error::invalid_access_token", + "component::doorbird::config::error::unknown": "common::config_flow::error::unknown", + "component::life360::config::abort::user_already_configured": "common::config_flow::abort::already_configured_account", + "component::xiaomi_miio::config::abort::already_configured": "common::config_flow::abort::already_configured_device", + "component::netatmo::config::abort::missing_configuration": "common::config_flow::abort::oauth2_missing_configuration", + "component::netatmo::config::abort::authorize_url_timeout": "common::config_flow::abort::oauth2_authorize_url_timeout", }, )