From 79d6c2e75af563f9253daf69c5b82979c18a4052 Mon Sep 17 00:00:00 2001 From: prabhjotsbhatia-ca <56749856+prabhjotsbhatia-ca@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:51:46 -0400 Subject: [PATCH] Add all supported languages to Google Translate and remove unsupported ones (#107404) * Adding supported language codes from Google Translate Added all languages that Google Translate supports. * Corrected alphabetical order of languages * Remove languages not actually supported for speech Previously I added languages supported by Google Translate. Based on comments received, I manually verified each language, and removed languages that are not actually supported for speech in Google Translate. * Add instructions to update the list of supported languages Added instructions as suggested so as to facilitate easier update on this list. * Reformat comment in const.py --------- Co-authored-by: Erik Montnemery --- .../components/google_translate/const.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/google_translate/const.py b/homeassistant/components/google_translate/const.py index 76827606816..68d8208f26b 100644 --- a/homeassistant/components/google_translate/const.py +++ b/homeassistant/components/google_translate/const.py @@ -7,8 +7,25 @@ DEFAULT_LANG = "en" DEFAULT_TLD = "com" DOMAIN = "google_translate" +# INSTRUCTIONS TO UPDATE LIST: +# +# Removal: +# Removal is as simple as deleting the line containing the language code no longer +# supported. +# +# Addition: +# In order to add to this list, follow the below steps: +# 1. Find out if the language is supported: Go to Google Translate website and try +# translating any word from English into your desired language. +# If the "speech" icon is grayed out or no speech is generated, the language is +# not supported and cannot be added. Otherwise, proceed: +# 2. Grab the language code from https://cloud.google.com/translate/docs/languages +# 3. Add the language code in SUPPORT_LANGUAGES, making sure to not disturb the +# alphabetical nature of the list. + SUPPORT_LANGUAGES = [ "af", + "am", "ar", "bg", "bn", @@ -20,16 +37,18 @@ SUPPORT_LANGUAGES = [ "de", "el", "en", - "eo", "es", "et", + "eu", "fi", + "fil", "fr", + "gl", "gu", + "ha", "hi", "hr", "hu", - "hy", "id", "is", "it", @@ -40,15 +59,16 @@ SUPPORT_LANGUAGES = [ "kn", "ko", "la", - "lv", "lt", - "mk", + "lv", "ml", "mr", + "ms", "my", "ne", "nl", "no", + "pa", "pl", "pt", "ro",