/** * @deprecated since 5.4.4. Use {@link #get(String, java.util.List)} instead. */ @Deprecated protected String getWithDefault(String key, String defaultMsg, Messages messages) { return messages.getWithDefault(key, defaultMsg); }
/** * @deprecated since 5.4.4. Use {@link #get(String, java.util.List)} instead. */ @Deprecated protected String getWithDefault(String key, List args, String defaultMsg, Messages messages) { Object[] argsArray = new Object[args.size()]; return messages.getWithDefault(key, args.toArray(argsArray), defaultMsg); }
/** * Use a default string. * * @param key key to find * @param defaultMsg default message * @return the message */ public static String getWithDefault(String key, String defaultMsg) { return getMessages().getWithDefault(key, defaultMsg); }
/** * Get a message with parameters inside: the value {0} must be a number. Use a default message. * * @param key key to find * @param args replacement strings * @param defaultMsg default message * @return the message */ public static String getWithDefault(String key, Object[] args, String defaultMsg) { return getMessages().getWithDefault(key, args, defaultMsg); }
/** * Get the message. * @param key key * @return message */ public String getMessage(String key) { return this.getMessages().getWithDefault(key, key); }
/** * Get the message from the renderer. Uses getMessages(). * @param key * @return the string found, or the key if not found */ public String getMessage(String key) { return getMessages().getWithDefault(key, key); }
/** * @deprecated since 5.4.4. Use new i18n mechanism instead. */ @Deprecated protected String getInterfaceMessage(String key) { return MessagesUtil.chainWithDefault(DEFAULT_I18N_BASENAME).getWithDefault(key, key); }
/** * Get the message with replacement strings. Use the {nr} syntax * @param key key * @param args replacement strings * @return message */ public String getMessage(String key, Object[] args) { return this.getMessages().getWithDefault(key, args, key); }
public static String getWithDefault(String key, String dflt, String basename) { return MessagesManager.getMessages(basename).getWithDefault(key, dflt); }
public static String getWithDefault(String key, String dflt) { return MessagesManager.getMessages().getWithDefault(key, dflt); }
public static String getWithDefault(String key, String dflt, String[] args) { return MessagesManager.getMessages().getWithDefault(key, args, dflt); }
public static String getWithDefault(String key, String dflt, String basename, String[] args) { return MessagesManager.getMessages(basename).getWithDefault(key, args, dflt); }
public static String getChainedWithDefault(String key, String dflt, String[] basenames) { return chain(basenames).getWithDefault(key, dflt); }
public static String getChainedWithDefault(String key, String dflt, String[] basenames, String[] args) { return chain(basenames).getWithDefault(key, args, dflt); }
/** * Uses the i18n mechanism to translate the message if the resulting string is a key. */ public static String getI18NString(Content node, String str, String basename) { String key = getString(node, str); return MessagesManager.getMessages(basename).getWithDefault(key, key); }
/** * @see info.magnolia.commands.MgnlCommand#execute(info.magnolia.context.Context) */ @Override public boolean execute(Context context) throws Exception { if (StringUtils.isNotEmpty(message)) { Messages msgs = MessagesUtil.chainWithDefault(this.getI18nBasename()); AlertUtil.setMessage(msgs.getWithDefault(message, message)); } return true; }
/** * @deprecated since 5.4.4. Use new i18n mechanism instead. */ @Deprecated protected String getDefinitionMessage(RenderableDefinition definition, String key) { Messages messages = MessagesUtil.chain(definition.getI18nBasename(), MessagesUtil.chainWithDefault(DEFAULT_I18N_BASENAME)); return messages.getWithDefault(key, key); }
/** * Uses the i18n mechanism to translate the message if the resulting string is a key. */ public static String getI18NString(Content node, String str) { Messages msgs = MessagesManager.getMessages(); String key = getString(node, str); String i18nBasename = null; try { i18nBasename = NodeDataUtil.inheritString(node, "i18nBasename"); } catch (RepositoryException e) { log.error("can't read i18nBasename value, will default back", e); } if (StringUtils.isNotEmpty(i18nBasename)) { msgs = MessagesUtil.chainWithDefault(i18nBasename); } return msgs.getWithDefault(key, key); }
public String getI18NTitle() { Messages msgs = MessagesManager.getMessages(getI18nBasename()); return msgs.getWithDefault(getTitle(), getTitle()); }
public String getI18NTitle() { Messages msgs = MessagesManager.getMessages(getI18nBasename()); return msgs.getWithDefault(getTitle(), getTitle()); }