How to change language in TTS notifications?

In configuration.yaml I have:

tts:
  - platform: google_translate
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300
    service_name: google_say
    language: "sr"

But when I set automation to send TTS message it reads text in English.

I tried setting language for notification but it did not help.

action:
  - service: notify.mobile_app_mrblack
    data:
      message: TTS
      data:
        tts_text: Vrata su otvorena!
        ttl: 0
        priority: high
        language: rs

Strange thing I noticed is that for Google TTS, I found out list of supported languages at Speech-to-Text supported languages  |  Cloud Speech-to-Text Documentation  |  Google Cloud. There it says I have to use “sr-RS” as language designator, but if I do that I get error in configuration specifying allowed designator and that message says I have to use “sr” as designator.

Then I found out somewhere that I actually have to set TTS on phone to specified language. When I did that it spoke text in proper language.

Why is that? It makes no sense that I have to know what language is set for TTS on some device to send notification. If there are several devices I use for notifications and they are for a reason set to use different languages I have to know which language is set for each and send separate notification?

Problem with setting TTS language on Android phone is that only English works on offline mode, when there is no Internet. So, one who uses car navigation or so, and does not have internet, must use English language set.

On my phone there are options to set automatic language recognition of TTS, so it seems it is possible to use several TTS languages on the phone.

Other approach could be to allow us to set TTS messages in several languages for notification so phone would use one that matches language that is set for TTS.

2 Likes

Looking for similar solution myself, but saw an issue in your code.

Configuration.yaml states

language: "sr"

your automations states

language: rs

“rs” or “sr”?

It is “sr” but makes no difference. Android seems not to follow language instruction.

In configuration.yaml I have: tts: - platform: google_translate cache: true cache_dir: /tmp/tts time_memory: 300 service_name: google_say … For some reason the notification language changed and german message textss are played love language test with an english TTS voice, although I did not change anything. First i press click to speak and after then open Radio button and select language… when i select english language then must be convert in …

Sorry for digging such an old post, but I had the same problem and I found solution - I had to open in my android device https://play.google.com/store/apps/details?id=com.google.android.tts (Speech Recognition & Synthesis) and download my language, that I hadn’t in this tool. After downloading and installing my native language everyting is OK, I can hear notification in my language :slight_smile: