Block title in strings.json unless internal or allowed (#53304)
This commit is contained in:
parent
b9a6ce77d1
commit
ce382a39d0
19 changed files with 83 additions and 63 deletions
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "AirNow",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Apple TV",
|
||||
"config": {
|
||||
"flow_title": "{name}",
|
||||
"step": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Bosch SHC",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
@ -35,4 +34,4 @@
|
|||
},
|
||||
"flow_title": "Bosch SHC: {name}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "ClimaCell",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Foscam",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
{
|
||||
"config": {
|
||||
"error": {
|
||||
"invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"url": "[%key:common::config_flow::data::url%]",
|
||||
"name": "Override for Habitica’s username. Will be used for service calls",
|
||||
"api_user": "Habitica’s API user ID",
|
||||
"api_key": "[%key:common::config_flow::data::api_key%]"
|
||||
},
|
||||
"description": "Connect your Habitica profile to allow monitoring of your user's profile and tasks. Note that api_id and api_key must be gotten from https://habitica.com/user/settings/api"
|
||||
}
|
||||
}
|
||||
"config": {
|
||||
"error": {
|
||||
"invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"title": "Habitica"
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"url": "[%key:common::config_flow::data::url%]",
|
||||
"name": "Override for Habitica’s username. Will be used for service calls",
|
||||
"api_user": "Habitica’s API user ID",
|
||||
"api_key": "[%key:common::config_flow::data::api_key%]"
|
||||
},
|
||||
"description": "Connect your Habitica profile to allow monitoring of your user's profile and tasks. Note that api_id and api_key must be gotten from https://habitica.com/user/settings/api"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Legrand Home+ Control",
|
||||
"config": {
|
||||
"step": {
|
||||
"pick_implementation": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Kostal Plenticore Solar Inverter",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
@ -18,4 +17,4 @@
|
|||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
},
|
||||
"error": {
|
||||
"account_locked": "Account locked. Please try again later.",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"email": "[%key:common::config_flow::data::email%]",
|
||||
"password": "[%key:common::config_flow::data::password%]",
|
||||
"region": "Region"
|
||||
},
|
||||
"description": "Please enter the email address and password you use to log into the MyMazda mobile app.",
|
||||
"title": "Mazda Connected Services - Add Account"
|
||||
}
|
||||
}
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
},
|
||||
"title": "Mazda Connected Services"
|
||||
}
|
||||
"error": {
|
||||
"account_locked": "Account locked. Please try again later.",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"email": "[%key:common::config_flow::data::email%]",
|
||||
"password": "[%key:common::config_flow::data::password%]",
|
||||
"region": "Region"
|
||||
},
|
||||
"description": "Please enter the email address and password you use to log into the MyMazda mobile app."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "MySensors",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -18,6 +18,5 @@
|
|||
"create_entry": {
|
||||
"default": "[%key:common::config_flow::create_entry::authenticated%]"
|
||||
}
|
||||
},
|
||||
"title": "Neato Botvac"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Picnic",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
@ -19,4 +18,4 @@
|
|||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "SIA Alarm Systems",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "SRP Energy",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Syncthing",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Wallbox",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
|
@ -19,4 +18,4 @@
|
|||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"title": "Z-Wave JS",
|
||||
"config": {
|
||||
"step": {
|
||||
"manual": {
|
||||
|
@ -113,4 +112,4 @@
|
|||
"value": "Current value of a Z-Wave Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,16 @@ class Integration:
|
|||
"""Return if integration is disabled."""
|
||||
return self.manifest.get("disabled")
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return name of the integration."""
|
||||
return self.manifest["name"]
|
||||
|
||||
@property
|
||||
def quality_scale(self) -> str:
|
||||
"""Return quality scale of the integration."""
|
||||
return self.manifest.get("quality_scale")
|
||||
|
||||
@property
|
||||
def requirements(self) -> list[str]:
|
||||
"""List of requirements."""
|
||||
|
|
|
@ -21,6 +21,20 @@ REMOVED = 2
|
|||
|
||||
RE_REFERENCE = r"\[\%key:(.+)\%\]"
|
||||
|
||||
# Only allow translatino of integration names if they contain non-brand names
|
||||
ALLOW_NAME_TRANSLATION = {
|
||||
"cert_expiry",
|
||||
"emulated_roku",
|
||||
"garages_amsterdam",
|
||||
"google_travel_time",
|
||||
"homekit_controller",
|
||||
"islamic_prayer_times",
|
||||
"local_ip",
|
||||
"nmap_tracker",
|
||||
"rpi_power",
|
||||
"waze_travel_time",
|
||||
}
|
||||
|
||||
REMOVED_TITLE_MSG = (
|
||||
"config.title key has been moved out of config and into the root of strings.json. "
|
||||
"Starting Home Assistant 0.109 you only need to define this key in the root "
|
||||
|
@ -257,6 +271,20 @@ def validate_translation_file(config: Config, integration: Integration, all_stri
|
|||
if strings_file.name == "strings.json":
|
||||
find_references(strings, name, references)
|
||||
|
||||
if (
|
||||
integration.domain not in ALLOW_NAME_TRANSLATION
|
||||
# Only enforce for core because custom integratinos can't be
|
||||
# added to allow list.
|
||||
and integration.core
|
||||
and strings.get("title") == integration.name
|
||||
and integration.quality_scale != "internal"
|
||||
):
|
||||
integration.add_error(
|
||||
"translations",
|
||||
"Don't specify title in translation strings if it's a brand name "
|
||||
"or add exception to ALLOW_NAME_TRANSLATION",
|
||||
)
|
||||
|
||||
platform_string_schema = gen_platform_strings_schema(config, integration)
|
||||
platform_strings = [integration.path.glob("strings.*.json")]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue