Package java.text

Examples of java.text.MessageFormat.applyPattern()


            context.getEngine().saveText( newContext,
                                          str.toString() );

            MessageFormat formatter = new MessageFormat("");
            formatter.applyPattern( rb.getString("bugreporthandler.new") );
            String[] args = { "<a href=\""+context.getViewURL(pageName)+"\">"+pageName+"</a>" };

            return formatter.format( args );
        }
        catch( RedirectException e )
View Full Code Here


    if (isEditorModulesCollapsed) {
      w.write("<div id=\"" + idCont + "\" class='meshcmsfieldlabel' " +
          " style=\"cursor:pointer;position:relative;\" onclick=\"javascript:editor_moduleShow('" +
          idCont + "','" + idElem + "','" + idIcon + "');\">" +
          "<img alt=\"\" src=\"" + adminRelPath.add("filemanager/images/bullet_toggle_plus.png") + "\" id=\"" + idIcon + "\" />\n");
      formatter.applyPattern(bundle.getString("editorModuleLocExt"));
      w.write("<label for=\"" + idElem + "\">" + formatter.format(args) + "</label>");
      w.write("</div>");
    }

    w.write("<fieldset "+ (isEditorModulesCollapsed ? "style=\"display:none;\"" : "") +
View Full Code Here

      w.write("</div>");
    }

    w.write("<fieldset "+ (isEditorModulesCollapsed ? "style=\"display:none;\"" : "") +
        " id=\""+ idElem +"\" class='meshcmseditor' >\n");
    formatter.applyPattern(bundle.getString("editorModuleLoc"));
    w.write(" <legend>" + formatter.format(args) + "</legend>\n");

    if (name != null) {
      w.write(bundle.getString("editorFixedModule"));
View Full Code Here

            value = bundle.getString(key);
            // perform argument substitutions
            if (arguments != null) {
                MessageFormat messageFormat = new MessageFormat("");
                messageFormat.setLocale(bundle.getLocale());
                messageFormat.applyPattern(value);
                try {
                    // This isn't fool-proof, but it's better than nothing
                    // The idea is to try and convert strings into the
                    // types of objects that the formatters expects
                    // i.e. Numbers and Dates
View Full Code Here

      w.write("<div id=\""+ idCont +"\" class='meshcmsfieldlabel' " +
          " style=\"cursor:pointer;\" onclick=\"javascript:editor_moduleShow('"+ idCont +"','"+ idElem +"','"+ idIcon +"');\">" +
          "<img alt=\"\" src=\"" + adminRelPath.add("/filemanager/images/bullet_toggle_plus.png") + "\" id=\""+ idIcon +"\" />\n");
      Object[] args = { bundle.getString("editorMailTitle"), email != null ? bundle.getString("editorMailTitle") : bundle.getString("editorNoTemplate"),
      Utils.noNull(email), "" };
      formatter.applyPattern(bundle.getString("editorModuleLocExt"));
      w.write("<label for=\""+ idElem +"\">"+ formatter.format(args) +"</label>");
      w.write("</div>");
    }
   
    w.write("<fieldset  "+ (isEditorModulesCollapsed ? "style=\"display:none;\"" : "") +
View Full Code Here

    Locale locale = WebUtils.getPageLocale(pageContext);
    ResourceBundle bundle = ResourceBundle.getBundle("org/meshcms/webui/Locales", locale);
    MessageFormat formatter = new MessageFormat("", locale);

    Object[] args = { getTitle() };
    formatter.applyPattern(bundle.getString("editorTitle"));
    getOut().write(formatter.format(args));
  }
}
View Full Code Here

            double[] choiceLimits = { 1, 2 };
           
            MessageFormat fmt = new MessageFormat("");
            fmt.setLocale( WikiContext.getLocale(m_context) );
            ChoiceFormat cfmt = new ChoiceFormat( choiceLimits, choiceString );
            fmt.applyPattern( type );
            Format[] formats = { NumberFormat.getInstance(), cfmt, NumberFormat.getInstance() };
            fmt.setFormats( formats );
           
            Object[] params = { changed.first() + 1,
                                changed.size(),
View Full Code Here

        // regardless of what locale is later specified!
        // It appears that the problem does not exist in JDK 1.4.

        MessageFormat messageFormat = new MessageFormat("");
        messageFormat.setLocale(_locale);
        messageFormat.applyPattern(pattern);

        convert(arguments);

        return messageFormat.format(arguments);
    }
View Full Code Here

                args = NO_ARGS;
            }

            MessageFormat messageFormat = new MessageFormat( "" );
            messageFormat.setLocale( locale );
            messageFormat.applyPattern( value );

            return messageFormat.format( args );
        }

        private final String getStringOrNull( ResourceBundle rb, String key )
View Full Code Here

   */
  public static String formatMessage(String key, Locale locale, Object[] params) {
    MessageFormat formatter = new MessageFormat("");
    formatter.setLocale(locale);
    String message = Utilities.formatMessage(key, locale);
    formatter.applyPattern(message);
    return formatter.format(params);
  }

  /**
   * Return the current ClassLoader.  First try to get the current thread's
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.