From ccb94ac6a6bf58cf210f2d6f85b66ab07a18d463 Mon Sep 17 00:00:00 2001 From: Manu <4445816+tr4nt0r@users.noreply.github.com> Date: Sun, 12 Jan 2025 16:27:31 +0100 Subject: [PATCH] Update translations and error messages in Bring! integration (#135455) * Update translations and error messages * use placeholder for field name * change key for translation string --- homeassistant/components/bring/strings.json | 18 +++++++++--------- homeassistant/components/bring/todo.py | 6 ++---- tests/components/bring/test_notification.py | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/bring/strings.json b/homeassistant/components/bring/strings.json index e65f9607afb..ea9af03484e 100644 --- a/homeassistant/components/bring/strings.json +++ b/homeassistant/components/bring/strings.json @@ -101,11 +101,11 @@ "setup_authentication_exception": { "message": "Authentication failed for {email}, check your email and password" }, - "notify_missing_argument_item": { - "message": "Failed to perform action {service}. 'URGENT_MESSAGE' requires a value @ data['item']. Got None" + "notify_missing_argument": { + "message": "This action requires field {field}, please enter a valid value for {field}" }, "notify_request_failed": { - "message": "Failed to send push notification for bring due to a connection error, try again later" + "message": "Failed to send push notification for Bring! due to a connection error, try again later" } }, "services": { @@ -122,8 +122,8 @@ "description": "Type of push notification to send to list members." }, "item": { - "name": "Article (Required if notification type `Urgent message` is selected)", - "description": "Article name to include in an urgent message e.g. `Urgent message - Please buy Cilantro urgently`" + "name": "Item (Required if notification type 'Urgent message' is selected)", + "description": "Item name(s) to include in an urgent message e.g. 'Attention! Attention! - We still urgently need: [Items]'" } } } @@ -131,10 +131,10 @@ "selector": { "notification_type_selector": { "options": { - "going_shopping": "I'm going shopping! - Last chance to make changes", - "changed_list": "List updated - Take a look at the articles", - "shopping_done": "Shopping done - The fridge is well stocked", - "urgent_message": "Urgent message - Please buy `Article` urgently" + "going_shopping": "I'm going shopping! - Last chance for adjustments", + "changed_list": "I changed the list! - Take a look at the items", + "shopping_done": "The shopping is done - Our fridge is well stocked", + "urgent_message": "Attention! Attention! - We still urgently need: [Items]" } } } diff --git a/homeassistant/components/bring/todo.py b/homeassistant/components/bring/todo.py index c53b5788b68..75657e2fd64 100644 --- a/homeassistant/components/bring/todo.py +++ b/homeassistant/components/bring/todo.py @@ -262,8 +262,6 @@ class BringTodoListEntity(BringBaseEntity, TodoListEntity): except ValueError as e: raise ServiceValidationError( translation_domain=DOMAIN, - translation_key="notify_missing_argument_item", - translation_placeholders={ - "service": f"{DOMAIN}.{SERVICE_PUSH_NOTIFICATION}", - }, + translation_key="notify_missing_argument", + translation_placeholders={"field": "item"}, ) from e diff --git a/tests/components/bring/test_notification.py b/tests/components/bring/test_notification.py index b1fa28335ad..711598d3f4b 100644 --- a/tests/components/bring/test_notification.py +++ b/tests/components/bring/test_notification.py @@ -65,7 +65,7 @@ async def test_send_notification_exception( mock_bring_client.notify.side_effect = BringRequestException with pytest.raises( HomeAssistantError, - match="Failed to send push notification for bring due to a connection error, try again later", + match="Failed to send push notification for Bring! due to a connection error, try again later", ): await hass.services.async_call( DOMAIN, @@ -94,7 +94,7 @@ async def test_send_notification_service_validation_error( with pytest.raises( HomeAssistantError, match=re.escape( - "Failed to perform action bring.send_message. 'URGENT_MESSAGE' requires a value @ data['item']. Got None" + "This action requires field item, please enter a valid value for item" ), ): await hass.services.async_call(