From 7ca539fcd041cc1cd22e13254e88b375013f663e Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 16:11:28 +0200 Subject: [PATCH] Migrate persistent notification services to support translations (#96391) * Migrate persistent notification services to support translations * Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --------- Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- .../persistent_notification/services.yaml | 14 -------- .../persistent_notification/strings.json | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 homeassistant/components/persistent_notification/strings.json diff --git a/homeassistant/components/persistent_notification/services.yaml b/homeassistant/components/persistent_notification/services.yaml index 046ea237560..c335d962600 100644 --- a/homeassistant/components/persistent_notification/services.yaml +++ b/homeassistant/components/persistent_notification/services.yaml @@ -1,39 +1,25 @@ create: - name: Create - description: Show a notification in the frontend. fields: message: - name: Message - description: Message body of the notification. required: true example: Please check your configuration.yaml. selector: text: title: - name: Title - description: Optional title for your notification. example: Test notification selector: text: notification_id: - name: Notification ID - description: Target ID of the notification, will replace a notification with the same ID. example: 1234 selector: text: dismiss: - name: Dismiss - description: Remove a notification from the frontend. fields: notification_id: - name: Notification ID - description: Target ID of the notification, which should be removed. required: true example: 1234 selector: text: dismiss_all: - name: Dismiss All - description: Remove all notifications. diff --git a/homeassistant/components/persistent_notification/strings.json b/homeassistant/components/persistent_notification/strings.json new file mode 100644 index 00000000000..6b8ddb46c49 --- /dev/null +++ b/homeassistant/components/persistent_notification/strings.json @@ -0,0 +1,36 @@ +{ + "services": { + "create": { + "name": "Create", + "description": "Shows a notification on the **Notifications** panel.", + "fields": { + "message": { + "name": "Message", + "description": "Message body of the notification." + }, + "title": { + "name": "Title", + "description": "Optional title of the notification." + }, + "notification_id": { + "name": "Notification ID", + "description": "ID of the notification. This new notification will overwrite an existing notification with the same ID." + } + } + }, + "dismiss": { + "name": "Dismiss", + "description": "Removes a notification from the **Notifications** panel.", + "fields": { + "notification_id": { + "name": "Notification ID", + "description": "ID of the notification to be removed." + } + } + }, + "dismiss_all": { + "name": "Dismiss all", + "description": "Removes all notifications from the **Notifications** panel." + } + } +}