@Test public void getLocaleCode_shouldReturnLocaleCode() throws Exception { assertThat(LocaleUtil.getLocaleCode("en_GB")).isEqualTo("en_GB"); }
public static String getLocaleCode(String localeStr) { Locale locale = FALLBACK; try { locale = (localeStr != null)? LocaleUtils.toLocale(localeStr):FALLBACK; } catch (IllegalArgumentException e) { logger.warn("cannot get locale from {}. Returning fallback locale: "+FALLBACK,localeStr); } return locale.toString(); }
LocaleUtil { public static String getLocaleCode(String localeStr) { Locale locale = FALLBACK; try { locale = (localeStr != null)? LocaleUtils.toLocale(localeStr):FALLBACK; } catch (IllegalArgumentException e) { logger.warn("cannot get locale from {}. Returning fallback locale: "+FALLBACK,localeStr); } return locale.toString(); } }
LocaleUtil { public static String getLocaleCode(String localeStr) { Locale locale = FALLBACK; try { locale = (localeStr != null)? LocaleUtils.toLocale(localeStr):FALLBACK; } catch (IllegalArgumentException e) { logger.warn("cannot get locale from {}. Returning fallback locale: "+FALLBACK,localeStr); } return locale.toString(); }  }
LocaleUtil { public static String getLocaleCode(String localeStr) { Locale locale = FALLBACK; try { locale = (localeStr != null)? LocaleUtils.toLocale(localeStr):FALLBACK; } catch (IllegalArgumentException e) { logger.warn("cannot get locale from {}. Returning fallback locale: "+FALLBACK,localeStr); } return locale.toString(); }  static String getLocaleCode(String localeStr); }
LocaleUtil { public static String getLocaleCode(String localeStr) { Locale locale = FALLBACK; try { locale = (localeStr != null)? LocaleUtils.toLocale(localeStr):FALLBACK; } catch (IllegalArgumentException e) { logger.warn("cannot get locale from {}. Returning fallback locale: "+FALLBACK,localeStr); } return locale.toString(); }  static String getLocaleCode(String localeStr); static final Locale FALLBACK; }