mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Block title in strings.json unless internal or allowed (#53304)
This commit is contained in:
parent
b9a6ce77d1
commit
ce382a39d0
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "AirNow",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Apple TV",
|
|
||||||
"config": {
|
"config": {
|
||||||
"flow_title": "{name}",
|
"flow_title": "{name}",
|
||||||
"step": {
|
"step": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Bosch SHC",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "ClimaCell",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Foscam",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"error": {
|
"error": {
|
||||||
"invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]",
|
"invalid_credentials": "[%key:common::config_flow::error::invalid_auth%]",
|
||||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"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": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"pick_implementation": {
|
"pick_implementation": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Kostal Plenticore Solar Inverter",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,26 +1,24 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"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": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -18,6 +18,5 @@
|
|||||||
"create_entry": {
|
"create_entry": {
|
||||||
"default": "[%key:common::config_flow::create_entry::authenticated%]"
|
"default": "[%key:common::config_flow::create_entry::authenticated%]"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"title": "Neato Botvac"
|
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Picnic",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "SIA Alarm Systems",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "SRP Energy",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Syncthing",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Wallbox",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"title": "Z-Wave JS",
|
|
||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"manual": {
|
"manual": {
|
||||||
|
@ -86,6 +86,16 @@ class Integration:
|
|||||||
"""Return if integration is disabled."""
|
"""Return if integration is disabled."""
|
||||||
return self.manifest.get("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
|
@property
|
||||||
def requirements(self) -> list[str]:
|
def requirements(self) -> list[str]:
|
||||||
"""List of requirements."""
|
"""List of requirements."""
|
||||||
|
@ -21,6 +21,20 @@ REMOVED = 2
|
|||||||
|
|
||||||
RE_REFERENCE = r"\[\%key:(.+)\%\]"
|
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 = (
|
REMOVED_TITLE_MSG = (
|
||||||
"config.title key has been moved out of config and into the root of strings.json. "
|
"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 "
|
"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":
|
if strings_file.name == "strings.json":
|
||||||
find_references(strings, name, references)
|
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_string_schema = gen_platform_strings_schema(config, integration)
|
||||||
platform_strings = [integration.path.glob("strings.*.json")]
|
platform_strings = [integration.path.glob("strings.*.json")]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user