title: Convert language code three characters (ISO 639-2) to two-character code (ISO 639-1)
body: <p>I'm developing an android app using Text-to-Speech (TTS) engine. TTS component return the list of available languages as list of <code>Locale</code> objects.</p>
  <p>But both methods <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html#getLanguage()" rel="nofollow noreferrer"><code>Locale::getLanguage</code></a> and <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html#getISO3Language()" rel="nofollow noreferrer"><code>Locale::getISO3Language</code></a> of each <code>Locale</code> object return the same 3-character code (ISO 639-2). Usually <code>getLanguage()</code> return the language code in 2-character format (ISO 639-1) but for a particular device the code is three characters. Same for country code. However I need to have the language and country code in two character format (ISO 639-1).</p>
  <p>Someone know a way to make a conversion? Please note, I need a corresponding <code>Locale</code> object with both language and country codes in two letter format.</p>