TranslationCardsISO { public static String getISOCodeForLanguage(String language) { if (language != null) { for (String isoCode : languageMap.keySet()) { if (languageMap.get(isoCode).contains(getTitleCaseName(language.trim()))) { return isoCode; } } } return INVALID_ISO_CODE; }  static String getISOCodeForLanguage(String language); static String getLanguageDisplayName(String isoCode, String sourceLanguageName); @NonNull static String getTitleCaseName(String name); static final String INVALID_LANGUAGE_NAME; }
@Test public void shouldFetchFAIsoCodeForPersianLanguageName() { assertEquals("fa", TranslationCardsISO.getISOCodeForLanguage("Persian")); }
@Test public void shouldFetchFAIsoCodeForFarsiLanguageName() { assertEquals("fa", TranslationCardsISO.getISOCodeForLanguage("Farsi")); }
@Test public void shouldGetYIIsoCodeForYiddishLanguageName() { assertEquals("yi", TranslationCardsISO.getISOCodeForLanguage("Yiddish")); }