info.magnolia.cms.i18n.Messages.getBasename()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中info.magnolia.cms.i18n.Messages.getBasename()方法的一些代码示例,展示了Messages.getBasename()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Messages.getBasename()方法的具体详情如下:
包路径:info.magnolia.cms.i18n.Messages
类名称:Messages
方法名:getBasename

Messages.getBasename介绍

[英]If no basename is provided this method returns DEFAULT_BASENAME.
[中]如果未提供basename,此方法将返回默认的\u basename。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Create a chain passing the wrapped head of the chain.
 */
public MessagesChain(Messages head) {
  super(head.getBasename(), head.getLocale());
  chain.add(head);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Adds Variables to a JS which can be used with the getMessage(key) method.
 *
 * @return Javascript-Construct of this text
 */
public static void generateJavaScript(Writer out, Messages messages) throws IOException {
  out.write("/* ###################################\n");
  out.write("### Generated AbstractMessagesImpl\n");
  out.write("################################### */\n\n");
  for (Iterator iter = messages.keys(); iter.hasNext(); ) {
    String key = (String) iter.next();
    if (key.endsWith(".js")) {
      String msg = javaScriptString(messages.get(key));
      out.write(AbstractMessagesImpl.JS_OBJECTNAME
          + ".add('"
          + key
          + "','"
          + msg
          + "','"
          + messages.getBasename()
          + "');");
      out.write("\n");
    }
  }
}

代码示例来源:origin: info.magnolia/magnolia-i18n

private LegacyMessage getLegacyMessage(Locale locale, String basename, String key) {
  final Messages messages = MessagesManager.getMessages(basename, locale);
  final String s = messages.get(key);
  return pairOrNull(messages.getBasename(), key, s);
}

相关文章