/** * Get the ISO 639-2/B 3 letter code * * @param language * the 2 letter ISO code to get the 3 letter code for * @return the 3 letter code * @since 2.0 */ public static String getISO3BLanguage(String language) { return getISO3BLanguage(Locale.forLanguageTag(language)); }
/** * uses our localized language mapping table, to get the iso3B code * * @param text * the language (as string) to get the iso3B code for * @return 3 chars or empty string * @since 2.0 */ public static String getIso3BLanguageFromLocalizedString(String text) { Locale l = KEY_TO_LOCALE_MAP.get(text.toLowerCase(Locale.ROOT)); if (l != null) { return getISO3BLanguage(l); } return ""; }
/** * opensubtitles need sometimes not ISO 639.2B - this method maps the exceptions * * @param locale * the language top be converted * @return the string accepted by opensubtitles */ private String getLanguageCode(Locale locale) { // default ISO 639.2B String languageCode = LanguageUtils.getISO3BLanguage(locale.getLanguage()); // and now the exceptions // greek: gre -> ell if ("gre".equals(languageCode)) { languageCode = "ell"; } return languageCode; }
langArray.put(LanguageUtils.getISO3BLanguage(base), base);