Update translations and error messages in Bring! integration (#135455)

* Update translations and error messages

* use placeholder for field name

* change key for translation string
This commit is contained in:
Manu 2025-01-12 16:27:31 +01:00 committed by GitHub
parent ab0dfe304c
commit ccb94ac6a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 15 deletions

View File

@ -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]"
}
}
}

View File

@ -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

View File

@ -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(