From 021aaa999498b7f0cbed9f427612947a7d369da1 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 12 Jul 2023 18:55:34 +0200 Subject: [PATCH] Migrate tts services to support translations (#96412) Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --- homeassistant/components/tts/services.yaml | 30 ----------- homeassistant/components/tts/strings.json | 60 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 30 deletions(-) create mode 100644 homeassistant/components/tts/strings.json diff --git a/homeassistant/components/tts/services.yaml b/homeassistant/components/tts/services.yaml index 99e0bcca4d4..03b176eaab3 100644 --- a/homeassistant/components/tts/services.yaml +++ b/homeassistant/components/tts/services.yaml @@ -1,88 +1,58 @@ # Describes the format for available TTS services say: - name: Say a TTS message - description: Say something using text-to-speech on a media player. fields: entity_id: - name: Entity - description: Name(s) of media player entities. required: true selector: entity: domain: media_player message: - name: Message - description: Text to speak on devices. example: "My name is hanna" required: true selector: text: cache: - name: Cache - description: Control file cache of this message. default: false selector: boolean: language: - name: Language - description: Language to use for speech generation. example: "ru" selector: text: options: - name: Options - description: - A dictionary containing platform-specific options. Optional depending on - the platform. advanced: true example: platform specific selector: object: speak: - name: Speak - description: Speak something using text-to-speech on a media player. target: entity: domain: tts fields: media_player_entity_id: - name: Media Player Entity - description: Name(s) of media player entities. required: true selector: entity: domain: media_player message: - name: Message - description: Text to speak on devices. example: "My name is hanna" required: true selector: text: cache: - name: Cache - description: Control file cache of this message. default: true selector: boolean: language: - name: Language - description: Language to use for speech generation. example: "ru" selector: text: options: - name: Options - description: - A dictionary containing platform-specific options. Optional depending on - the platform. advanced: true example: platform specific selector: object: clear_cache: - name: Clear TTS cache - description: Remove all text-to-speech cache files and RAM cache. diff --git a/homeassistant/components/tts/strings.json b/homeassistant/components/tts/strings.json new file mode 100644 index 00000000000..2f0208ef8b5 --- /dev/null +++ b/homeassistant/components/tts/strings.json @@ -0,0 +1,60 @@ +{ + "services": { + "say": { + "name": "Say a TTS message", + "description": "Says something using text-to-speech on a media player.", + "fields": { + "entity_id": { + "name": "Entity", + "description": "Media players to play the message." + }, + "message": { + "name": "Message", + "description": "The text you want to convert into speech so that you can listen to it on your device." + }, + "cache": { + "name": "Cache", + "description": "Stores this message locally so that when the text is requested again, the output can be produced more quickly." + }, + "language": { + "name": "Language", + "description": "Language to use for speech generation." + }, + "options": { + "name": "Options", + "description": "A dictionary containing integration-specific options." + } + } + }, + "speak": { + "name": "Speak", + "description": "Speaks something using text-to-speech on a media player.", + "fields": { + "media_player_entity_id": { + "name": "Media player entity", + "description": "Media players to play the message." + }, + "message": { + "name": "[%key:component::tts::services::say::fields::message::name%]", + "description": "[%key:component::tts::services::say::fields::message::description%]" + }, + "cache": { + "name": "[%key:component::tts::services::say::fields::cache::name%]", + "description": "[%key:component::tts::services::say::fields::cache::description%]" + }, + "language": { + "name": "[%key:component::tts::services::say::fields::language::name%]", + "description": "[%key:component::tts::services::say::fields::language::description%]" + }, + "options": { + "name": "[%key:component::tts::services::say::fields::options::name%]", + "description": "[%key:component::tts::services::say::fields::options::description%]" + } + } + }, + "clear_cache": { + "name": "Clear TTS cache", + "description": "Removes all cached text-to-speech files and purges the memory." + } + } +}