title: How to validate SFSpeechRecognizer Speech language identifier using Swift?
body: <p>My scenario, I am trying to pass the language code based on it <code>SFSpeechRecognizer</code> changing language for <code>speech to text</code>. Here, I can able to use only apple provided <code>63 languages</code>. If I pass some other languages I am getting crash because of language unavailability. How to validate and handle it in a proper way using <code>swift</code>?</p>
  
  <p>My Code</p>
  
  <pre><code>private let speechRecognizer = SFSpeechRecognizer(locale: Locale.init(identifier: "en-US"))  //1
  </code></pre>
  
  <p>I  followed below tutorial for implementing speech to text </p>
  
  <blockquote>
    <p><a href="https://www.appcoda.com/siri-speech-framework/" rel="nofollow noreferrer">https://www.appcoda.com/siri-speech-framework/</a></p>
  </blockquote>