@Test public void verifyWhenLocaleExists_canResolveCode() { MessageFormat mf = jsonMessageSource.resolveCode("testAttribute", localeThatHasAFile); assertEquals(mf.getLocale().getLanguage(), "en"); assertEquals(mf.toPattern(), "testValue"); }
@Override protected MessageFormat resolveCode(String code, Locale locale) { List<JsonObject> langs = getLanguageMap(locale); String value = getValue(code, langs); if (value == null) { langs = getLanguageMap(fallbackLocale); value = getValue(code, langs); } if (value == null) { return null; } else { return new MessageFormat(value, locale); } }
JsonMessageSource extends AbstractMessageSource { @Override protected MessageFormat resolveCode(String code, Locale locale) { List<JsonObject> langs = getLanguageMap(locale); String value = getValue(code, langs); if (value == null) { langs = getLanguageMap(fallbackLocale); value = getValue(code, langs); } if (value == null) { return null; } else { return new MessageFormat(value, locale); } } }
JsonMessageSource extends AbstractMessageSource { @Override protected MessageFormat resolveCode(String code, Locale locale) { List<JsonObject> langs = getLanguageMap(locale); String value = getValue(code, langs); if (value == null) { langs = getLanguageMap(fallbackLocale); value = getValue(code, langs); } if (value == null) { return null; } else { return new MessageFormat(value, locale); } }  }
JsonMessageSource extends AbstractMessageSource { @Override protected MessageFormat resolveCode(String code, Locale locale) { List<JsonObject> langs = getLanguageMap(locale); String value = getValue(code, langs); if (value == null) { langs = getLanguageMap(fallbackLocale); value = getValue(code, langs); } if (value == null) { return null; } else { return new MessageFormat(value, locale); } }  Resource getBaseDirectory(); void setBaseDirectory(Resource baseDirectory); }
JsonMessageSource extends AbstractMessageSource { @Override protected MessageFormat resolveCode(String code, Locale locale) { List<JsonObject> langs = getLanguageMap(locale); String value = getValue(code, langs); if (value == null) { langs = getLanguageMap(fallbackLocale); value = getValue(code, langs); } if (value == null) { return null; } else { return new MessageFormat(value, locale); } }  Resource getBaseDirectory(); void setBaseDirectory(Resource baseDirectory);  }