@Override public Map<String, String> getAllTranslationsForPrefix(String prefix) { return i18nResolver.getAllTranslationsForPrefix(prefix); }
@Override public Map<String, String> getAllTranslationsForPrefix(String prefix, Locale locale) { return i18nResolver.getAllTranslationsForPrefix(prefix, locale); }
public Map<String, String> getAllTranslationsForPrefix(String prefix, Locale locale) { return i18nResolver.getAllTranslationsForPrefix(prefix, locale); }
@Test public void testGetAllTranslationsForPrefix() { final Map<String, String> translations = resolver.getAllTranslationsForPrefix("some.key.that.doesnt.exist", Locale.US); assertTrue("Should return empty map of translations for unknown key", translations.keySet().isEmpty()); }
/** * NB: This method should be called from a servlet or rest resource, because it attempt to look at the request * and to detect the request locale. * * @param prefix the prefix for the i18n keys, used to fetch a subset of all i18n keys of the application * @return the builder */ public BatchedJSONI18nBuilder withProperties(final String prefix) { final HttpServletRequest request = CurrentContext.getHttpServletRequest(); final Locale locale = localeResolver.getLocale(request); putAll(i18nResolver.getAllTranslationsForPrefix(prefix, locale)); return this; }
public void execute(final CtkTestResults results) { results.assertTrue("I18nResolver should be injectable", resolver != null); final Message msg = resolver.createMessage("key", "arg1"); results.assertTrue("Should create valid message", msg.getArguments().length == 1 && "key".equals(msg.getKey())); results.assertTrue("Should create message collection", resolver.createMessageCollection() != null); results.assertTrue("Should return key if text can't be resolved", "some.key.that.doesnt.exist".equals(resolver.getText("some.key.that.doesnt.exist"))); final Map<String,String> translations = resolver.getAllTranslationsForPrefix("some.key.that.doesnt.exist", Locale.US); results.assertTrue("Should return empty map of translations for unknown key", translations.keySet().isEmpty()); } }