From 6b980eb0a7b66c3054ab138c9b907d830835cceb Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 24 Jul 2023 18:35:26 +0200 Subject: [PATCH] Migrate frontend services to support translations (#96342) Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- .../components/frontend/services.yaml | 16 ++-------- .../components/frontend/strings.json | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 homeassistant/components/frontend/strings.json diff --git a/homeassistant/components/frontend/services.yaml b/homeassistant/components/frontend/services.yaml index 0cc88baf32f..8e6820fb5bb 100644 --- a/homeassistant/components/frontend/services.yaml +++ b/homeassistant/components/frontend/services.yaml @@ -1,29 +1,19 @@ # Describes the format for available frontend services set_theme: - name: Set theme - description: Set a theme unless the client selected per-device theme. fields: name: - name: Theme - description: Name of a predefined theme required: true example: "default" selector: theme: include_default: true mode: - name: Mode - description: The mode the theme is for. default: "light" selector: select: options: - - label: "Dark" - value: "dark" - - label: "Light" - value: "light" - + - "dark" + - "light" + translation_key: mode reload_themes: - name: Reload themes - description: Reload themes from YAML configuration. diff --git a/homeassistant/components/frontend/strings.json b/homeassistant/components/frontend/strings.json new file mode 100644 index 00000000000..b5fdeb612c4 --- /dev/null +++ b/homeassistant/components/frontend/strings.json @@ -0,0 +1,30 @@ +{ + "services": { + "set_theme": { + "name": "Set the default theme", + "description": "Sets the default theme Home Assistant uses. Can be overridden by a user.", + "fields": { + "name": { + "name": "Theme", + "description": "Name of a theme." + }, + "mode": { + "name": "Mode", + "description": "Theme mode." + } + } + }, + "reload_themes": { + "name": "Reload themes", + "description": "Reloads themes from the YAML-configuration." + } + }, + "selector": { + "mode": { + "options": { + "dark": "Dark", + "light": "Light" + } + } + } +}