Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-4050

Pass arguments to messages in webengine

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3 RC
    • Component/s: None
    • Upgrade notes:
      Hide

      WebengineContext interface changes:
      Context.getMessage(String, String... args) has been changed into Context.getMessage(String, Object... args) so that all standard MessageFormat formatting features can be used.
      new method Context.getMessage(String, List<String>) has been added for freemarker to resolve the method correctly with sequential args.
      Same for getMessageL methods.

      Show
      WebengineContext interface changes: Context.getMessage(String, String... args) has been changed into Context.getMessage(String, Object... args) so that all standard MessageFormat formatting features can be used. new method Context.getMessage(String, List<String>) has been added for freemarker to resolve the method correctly with sequential args. Same for getMessageL methods.

      Description

      Currently it's not possible to pass arguments to a message to translate using the method Context.getMessage(message, args...).

      When trying to print something like:
      ${Context.getMessage('my.sentence.with.date', current_date)}

      With current_date a string, the error is:

      Caused by: freemarker.template.TemplateModelException: Could not convert an instance of freemarker.template.SimpleScalar with value [22/09/09] to [Ljava.lang.String;

      When trying to pass it as an array, the error is:

      Caused by: freemarker.template.TemplateModelException: Could not convert an instance of freemarker.template.SimpleSequence with value [[22/09/09]] to java.lang.String

        Attachments

          Activity

            People

            • Assignee:
              atchertchian Anahide Tchertchian
              Reporter:
              atchertchian Anahide Tchertchian
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: