code: public static Locale convertLanguageToLocale(final String planguage) {
      final Locale locale;
      if (planguage == null) {
        locale = null;
      } else {
        final String localeStringUp = planguage.toUpperCase().replace('-', '_');
        if (LocaleUtil.DEFAULT_MAP.containsKey(localeStringUp)) {
          locale = LocaleUtil.DEFAULT_MAP.get(localeStringUp);
        } else if (localeStringUp.contains("_")) {
          final String[] lcoaleSplitted = localeStringUp.split("_");
          if (lcoaleSplitted.length > 2) {
            locale =
                new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1], lcoaleSplitted[2]);
          } else {
            locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1]);
          }
        } else {
          locale = new Locale(planguage);
        }
      }
      return locale;
    }
docs: convert language string to Locale.
  
  @param planguage string with language value
  @return Locale for the language