Use references in Neato translation strings (#41009)

* Replace unexpected_error with unknown key in Neato

* Replace string with reference

* Revert the specific language json files back to unexpected_error

* Use reference for already_configured

* Change invalid_credentials to invalid_auth key

* Use reference for invalid_auth

* Use invalid_auth in the neato test

* Replace abort.invalid_credentials with invalid_auth
This commit is contained in:
Melvin 2020-10-03 02:42:07 +02:00 committed by GitHub
parent 3a266fa116
commit 414633a129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -105,8 +105,8 @@ class NeatoConfigFlow(config_entries.ConfigFlow, domain=NEATO_DOMAIN):
try:
Account(username, password, this_vendor)
except NeatoLoginException:
return "invalid_credentials"
return "invalid_auth"
except NeatoRobotException:
return "unexpected_error"
return "unknown"
return None

View file

@ -12,15 +12,15 @@
}
},
"error": {
"invalid_credentials": "Invalid credentials",
"unexpected_error": "Unexpected error"
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"create_entry": {
"default": "See [Neato documentation]({docs_url})."
},
"abort": {
"already_configured": "Already configured",
"invalid_credentials": "Invalid credentials"
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
}
}
}

View file

@ -118,7 +118,7 @@ async def test_abort_on_invalid_credentials(hass):
}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {"base": "invalid_credentials"}
assert result["errors"] == {"base": "invalid_auth"}
result = await flow.async_step_import(
{
@ -128,7 +128,7 @@ async def test_abort_on_invalid_credentials(hass):
}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "invalid_credentials"
assert result["reason"] == "invalid_auth"
async def test_abort_on_unexpected_error(hass):
@ -147,7 +147,7 @@ async def test_abort_on_unexpected_error(hass):
}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {"base": "unexpected_error"}
assert result["errors"] == {"base": "unknown"}
result = await flow.async_step_import(
{
@ -157,4 +157,4 @@ async def test_abort_on_unexpected_error(hass):
}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "unexpected_error"
assert result["reason"] == "unknown"