Skip to content

Commit

Permalink
Update translations and error messages in Bring! integration (#135455)
Browse files Browse the repository at this point in the history
* Update translations and error messages

* use placeholder for field name

* change key for translation string
  • Loading branch information
tr4nt0r authored Jan 12, 2025
1 parent ab0dfe3 commit ccb94ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 9 additions & 9 deletions homeassistant/components/bring/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -122,19 +122,19 @@
"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]'"
}
}
}
},
"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]"
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/bring/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ async def async_send_message(
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
4 changes: 2 additions & 2 deletions tests/components/bring/test_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ccb94ac

Please sign in to comment.