Add config flow base strings (#34523)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-05-04 20:10:39 -07:00
1 parent 0e17f619c8
commit 34e35f6aa3
13 files changed
+113 -39

No files matched your search

+24 -11
View File
@@ -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%]"
},
},
)
+17 -4
View File
@@ -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",
},
)