What are the supported languages with AVSpeechSynthesizer?

4.6k Views Asked by At

AVSpeechSynthesizer seems to support english with multi delegates (britsh, us...)

Does it support other languages? french, Portuguese ... is there a list of these languages somewhere ?

2

There are 2 best solutions below

0
On BEST ANSWER

Yes, it does. Use speechVoices of AVSpeechSynthesisVoice to get a list of available voices with supported languages.

let voices = AVSpeechSynthesisVoice.speechVoices() //list of supported voices
print(voices[0].language)                          //print first voice locale

Currently (as of 10 September 2018, on iOS 10.3.1 and 11.4.1) you'll find these:

  • ar-SA
  • cs-CZ
  • da-DK
  • de-DE
  • el-GR
  • en-AU
  • en-GB
  • en-IE
  • en-US
  • en-ZA
  • es-ES
  • es-MX
  • fi-FI
  • fr-CA
  • fr-FR
  • he-IL
  • hi-IN
  • hu-HU
  • id-ID
  • it-IT
  • ja-JP
  • ko-KR
  • nl-BE
  • nl-NL
  • no-NO
  • pl-PL
  • pt-BR
  • pt-PT
  • ro-RO
  • ru-RU
  • sk-SK
  • sv-SE
  • th-TH
  • tr-TR
  • zh-CN
  • zh-HK
  • zh-TW
1
On

these two little functions will help:

import AVFoundation
import Foundation

func getSpeechSupportedRegionalLanguages() -> [String] {
    let voices = AVSpeechSynthesisVoice.speechVoices()
    var languages: Set<String> = []
    let english = Locale(identifier: "en")
    voices.forEach{languages.insert(english.localizedString(forIdentifier: $0.language)!)}
    return Array(languages).sorted()
}

func getSpeechSupportedLanguages() -> [String] {
    let voices = AVSpeechSynthesisVoice.speechVoices()
    var languages: Set<String> = []
    let english = Locale(identifier: "en")
    voices.forEach{languages.insert(english.localizedString(forLanguageCode: $0.language)!)}
    return Array(languages).sorted()
}

2024.02.17 result

without regional variants (33 total):

  1. Arabic
  2. Bulgarian
  3. Catalan
  4. Chinese
  5. Croatian
  6. Czech
  7. Danish
  8. Dutch
  9. English
  10. Finnish
  11. French
  12. German
  13. Greek
  14. Hebrew
  15. Hindi
  16. Hungarian
  17. Indonesian
  18. Italian
  19. Japanese
  20. Korean
  21. Malay
  22. Norwegian Bokmål
  23. Polish
  24. Portuguese
  25. Romanian
  26. Russian
  27. Slovak
  28. Spanish
  29. Swedish
  30. Thai
  31. Turkish
  32. Ukrainian
  33. Vietnamese

with regional variants (44 total):

  1. Arabic (world)
  2. Bulgarian (Bulgaria)
  3. Catalan (Spain)
  4. Chinese (China mainland)
  5. Chinese (Hong Kong)
  6. Chinese (Taiwan)
  7. Croatian (Croatia)
  8. Czech (Czechia)
  9. Danish (Denmark)
  10. Dutch (Belgium)
  11. Dutch (Netherlands)
  12. English (Australia)
  13. English (India)
  14. English (Ireland)
  15. English (South Africa)
  16. English (United Kingdom)
  17. English (United States)
  18. Finnish (Finland)
  19. French (Canada)
  20. French (France)
  21. German (Germany)
  22. Greek (Greece)
  23. Hebrew (Israel)
  24. Hindi (India)
  25. Hungarian (Hungary)
  26. Indonesian (Indonesia)
  27. Italian (Italy)
  28. Japanese (Japan)
  29. Korean (South Korea)
  30. Malay (Malaysia)
  31. Norwegian Bokmål (Norway)
  32. Polish (Poland)
  33. Portuguese (Brazil)
  34. Portuguese (Portugal)
  35. Romanian (Romania)
  36. Russian (Russia)
  37. Slovak (Slovakia)
  38. Spanish (Mexico)
  39. Spanish (Spain)
  40. Swedish (Sweden)
  41. Thai (Thailand)
  42. Turkish (Türkiye)
  43. Ukrainian (Ukraine)
  44. Vietnamese (Vietnam)