protected Object decorate(String undecoratedResult, T proxiedObject, Method method) { final String[] keys; if (undecoratedResult != null) { keys = new String[]{undecoratedResult}; } else { keys = keyGenerator.keysFor(undecoratedResult, proxiedObject, method); } final String basename = keyGenerator.messageBundleNameFor(proxiedObject); return translationService.translate(localeProvider, basename, keys); }
/** * Description displayed to the user when clicking on the info button. */ @I18nText String getDescription();
/** * For manual invocations - see {@link GenerateTranslationFilesImpl}. */ public ToolingProxytoysI18nizer(final GeneratorResults genRes, final Locale locale, final TranslationService translationService) { this(genRes, translationService, new FixedLocaleProvider(locale)); }
/** * TestI18nAbleRootObject. */ @I18nable(keyGenerator = TestI18nAbleRootObjectKeyGen.class) public class TestI18nAbleRootObject extends TestRootObject { @I18nText public String getFoo() { return "foo"; } }
/** * We still use the deprecated method {@link TranslationService#translate(info.magnolia.i18nsystem.LocaleProvider, String, String[])} due to compatibility with obsolete i18nBasename, the method {@link TranslationService#translate(info.magnolia.i18nsystem.LocaleProvider, String[])} calls this method internally anyway. */ public String get(String key) { return translationService.translate(localeProvider, basename, new String[]{key}); }
@Test public void nullKey() throws Exception { //GIVEN NullKeyGenerator keyGenerator = new NullKeyGenerator(); String[] keys = keyGenerator.keysFor(null, null, null); // WHEN translationService.translate(newFixedLocaleProvider(Locale.ENGLISH), null, keys); // THEN doesn't fail with NPE in TranslationServiceImpl.doGetMessage() }
@Override public String translate(LocaleProvider localeProvider, String[] keys) { return translate(localeProvider, null, keys); }
/** * Error message text displayed in case of required = true. */ @I18nText String getRequiredErrorMessage();
/** * Fake ChooseDialogDefinition - cannot use the right one here, as it is defined in a dependent artifact. */ @I18nable public static class TestChooseDialogDefinition { private Map<String, ActionDefinition> actions = new HashMap<>(); public Map<String, ActionDefinition> getActions() { return this.actions; } }
@Override public String translate(LocaleProvider localeProvider, String basename, String[] keys) { if (translationOff) { return keys == null || keys.length == 0 ? null : keys[0]; } else { return super.translate(localeProvider, basename, keys); } }
/** * Message text displayed in case of conversion error. */ @I18nText String getConversionErrorMessage();
/** * @return the button Label displayed when no link is yet selected. */ @I18nText public String getButtonSelectNewLabel() { return buttonSelectNewLabel; }
/** * Returns the error message if a redirection cascade ends up on a "404 situation". * @see {@link RedirectTargetValidator} for further details. */ @I18nText public String getErrorMessageFor404() { return errorMessageFor404; }
@I18nText public String getRightColumnCaption() { return rightColumnCaption; } }
@I18nText public String getLeftColumnCaption() { return leftColumnCaption; }
@I18nText public String getPlaceholder() { return placeholder; }
@I18nText public String getButtonSelectNewDefaultLabel() { return this.buttonSelectNewLabel; }
@I18nText public Float getFloat() { return f_loat; } }
@I18nText public String getLabel() { return label; }