title: Locale in Java returns "" for language
body: <p>I am not quite sure if I understand Locale in Java. I have an enum:</p>
  <pre><code>protected enum LanguageCode {
    ENGLISH(Locale.forLanguageTag(&quot;en_GB&quot;)),
    GERMAN(Locale.forLanguageTag(&quot;de_DE&quot;)),
    FRENCH(Locale.forLanguageTag(&quot;fr_FR&quot;)),
    DUTCH(Locale.forLanguageTag(&quot;nl_NL&quot;)),
    DEFAULT(Locale.forLanguageTag(&quot;en_GB&quot;));
  
    private final Locale locale;
  
    LanguageCode(Locale locale) {
      this.locale = locale;
    }
    public Locale getLocale() {
      return locale;
    }
      
    public String getLanguage() {
      return locale.getLanguage();
    }
    public static boolean containsLanguage(String value) {
      for (LanguageCode code : LanguageCode.values()) {
        if (code.getLocale().getLanguage().equalsIgnoreCase(value)) {
          return true;
        }
      }
      return false;
    }
  }
  </code></pre>
  <p>But when I do</p>
  <pre><code>String result = &quot;en&quot;;
  LanguageCode.containsLanguage(result);
  </code></pre>
  <p>it returns false. I would expect to have a match for the <code>ENGLISH(Locale.forLanguageTag(&quot;en_GB&quot;))</code>, but all the languages are <code>&quot;&quot;</code>. What do I do wrong?</p>