Package com.dotcms.repackage.org.apache.struts.util

Examples of com.dotcms.repackage.org.apache.struts.util.MessageResources


   * @since VelocityTools 1.1
   * @return the localized message for the specified key or <code>null</code>
   *         if no such message exists
   */
  public String get(String key, String bundle, Object args[]) {
    MessageResources res = getResources(bundle);
    if (res == null) {
      return key;
    }

    // return the requested message
    if (args == null) {
      String x = res.getMessage(this.locale, key);
      if (x != null && ! x.startsWith("???")) {
        return x;
      } else {
        return key;
      }

    } else {
      return res.getMessage(this.locale, key, args);
    }
  }
View Full Code Here


   * @since VelocityTools 1.1
   * @return <code>true</code> if a message strings exists,
   *         <code>false</code> otherwise
   */
  public boolean exists(String key, String bundle) {
    MessageResources res = getResources(bundle);
    if (res == null) {
      return false;
    }

    // Return the requested message presence indicator
    return res.isPresent(this.locale, key);
  }
View Full Code Here

     * @return the localized message for the specified key or
     * <code>null</code> if no such message exists
     */
    public String get(String key, String bundle, Object args[])
    {
        MessageResources res = getResources(bundle);
        if (res == null)
        {
            return null;
        }

        // return the requested message
        if (args == null)
        {
            return res.getMessage(this.locale, key);
        }
        else
        {
            return res.getMessage(this.locale, key, args);
        }
    }
View Full Code Here

     * @return <code>true</code> if a message strings exists,
     * <code>false</code> otherwise
     */
    public boolean exists(String key, String bundle)
    {
        MessageResources res = getResources(bundle);
        if (res == null)
        {
            return false;
        }

        // Return the requested message presence indicator
        return res.isPresent(this.locale, key);
    }
View Full Code Here

                LOG.error("Message resources are not available.");
            }
            return resources;
        }
       
        MessageResources res =
            StrutsUtils.getMessageResources(request, application, bundle);
        if (res == null)
        {
            LOG.error("MessageResources bundle '" + bundle + "' is not available.");
        }
View Full Code Here

     */
    public static MessageResources getMessageResources(HttpServletRequest request,
                                                       ServletContext app,
                                                       String bundle)
    {
        MessageResources resources = null;

        /* Identify the current module */
        ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request, app);


View Full Code Here

        String footer = null;
        String prefix = null;
        String suffix = null;
        Locale locale = getLocale(request, session);

        MessageResources resources =
            getMessageResources(request, application, bundle);
        if (resources != null)
        {
            header = resources.getMessage(locale, "errors.header");
            footer = resources.getMessage(locale, "errors.footer");
            prefix = resources.getMessage(locale, "errors.prefix");
            suffix = resources.getMessage(locale, "errors.suffix");
        }
        if (header == null)
        {
            header = "errors.header";
        }
        if (footer == null)
        {
            footer = "errors.footer";
        }
        /* prefix or suffix are optional, be quiet if they're missing */
        if (prefix == null)
        {
            prefix = "";
        }
        if (suffix == null)
        {
            suffix = "";
        }

        results.append(header);
        results.append("\r\n");

        String message;
        while (reports.hasNext())
        {
            message = null;
            ActionMessage report = (ActionMessage)reports.next();
            if (resources != null) //&& report.isResource() DOTCMS-4819
            {
                message = resources.getMessage(locale,
                                               report.getKey(),
                                               report.getValues());
            }

            results.append(prefix);
View Full Code Here

                                          Locale locale,
                                          Form form)
    {
        StringBuffer results = new StringBuffer();

        MessageResources messages =
            StrutsUtils.getMessageResources(request, app);

        List actions = createActionList(resources, form);

        final String methods = createMethods(actions);
View Full Code Here

        if (!msgs.hasNext())
        {
            return null;
        }

        MessageResources res = getResources(bundle);
        List list = new ArrayList();
        
        while (msgs.hasNext())
        {
            ActionMessage msg = (ActionMessage)msgs.next();

            String message = null;
            if (res != null ) //&& msg.isResource() DOTCMS-4819
            {
                message =
                    res.getMessage(this.locale, msg.getKey(), msg.getValues());

                if (message == null)
                {
                    LOG.warn("Message for key " + msg.getKey() +
                             " could not be found in message resources.");
View Full Code Here

      return null;
    }
    String value = null;
    Logger.debug(LanguageUtil.class, key);
    try {
      MessageResources resources = (MessageResources)WebAppPool.get(
        company.getCompanyId(), Globals.MESSAGES_KEY);
     
      if (resources != null)
        value = resources.getMessage(company.getLocale(), key);
    }
    catch (Exception e) {
      throw new LanguageException(e);
    }
 
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.apache.struts.util.MessageResources

Copyright © 2018 www.massapicom. 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.