<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ActionExecution + I18NUtil - messages are not included in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86479#M26139</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/76427"&gt;@p31r&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Glad to see you got it sorted - thanks also for reporting the solution, really helpful for others ecountering similar problems.&lt;/P&gt;
&lt;P&gt;Best wishes,&lt;/P&gt;</description>
    <pubDate>Thu, 20 Feb 2020 14:56:36 GMT</pubDate>
    <dc:creator>EddieMay</dc:creator>
    <dc:date>2020-02-20T14:56:36Z</dc:date>
    <item>
      <title>ActionExecution + I18NUtil - messages are not included</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86476#M26136</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;We have just encounter strange "bug?" (is it bug or I am only dumb?)&lt;/P&gt;&lt;P&gt;We've implemented Custom Repo action - "SampleAction extends ActionExecuterAbstractBase()"&lt;/P&gt;&lt;P&gt;and call it with this sample (test call):&lt;/P&gt;&lt;PRE&gt;action = &lt;SPAN&gt;actionService&lt;/SPAN&gt;.createAction(SampleAction.&lt;SPAN&gt;NAME&lt;/SPAN&gt;)&lt;BR /&gt;action.setParameterValue(SampleAction.&lt;SPAN&gt;PARAM_QUERY&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;query)&lt;BR /&gt;action.setExecuteAsynchronously(&lt;SPAN&gt;true&lt;/SPAN&gt;) // here is the problem when async is true&lt;BR /&gt;&lt;SPAN&gt;actionService&lt;/SPAN&gt;.executeAction(action&lt;SPAN&gt;, null&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Strange thing happens with asynchronous execution.&lt;/P&gt;&lt;P&gt;In code we try to retrieve localized messages from I18NUtil:&lt;/P&gt;&lt;PRE&gt;I18NUtil.getMessage(&lt;SPAN&gt;"action.sample.msg"&lt;/SPAN&gt;)&lt;BR /&gt;// or&lt;BR /&gt;messageService.getMessage("&lt;SPAN&gt;action.sample.msg&lt;/SPAN&gt;")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;When action is called with asynchronous=false -&amp;gt; everything is alright.&lt;/P&gt;&lt;P&gt;But when asynchronous=true -&amp;gt; I18NUtil or even messageService can not find the message (returns null)&lt;/P&gt;&lt;P&gt;I've tried debug through I18NUtil.getMessage() - seems that budles are there with messages, but can not retrieve the exact message&lt;/P&gt;&lt;P&gt;Status report: we debugged I18NUtil a little bit more: when called from the asynchronous action - our custom budles are cached, but messages from this context are not (not even one message from our custom bundles)&lt;/P&gt;&lt;P&gt;Message budles are registered as follows:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;bean &lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;="custom.base.dictionaryBootstrap"&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;parent&lt;/SPAN&gt;&lt;SPAN&gt;="dictionaryModelBootstrap"&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;depends-on&lt;/SPAN&gt;&lt;SPAN&gt;="dictionaryBootstrap"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;property &lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;="labels"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;alfresco.module.${project.artifactId}.messages.customActions&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;property&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;bean&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 13:08:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86476#M26136</guid>
      <dc:creator>p31r</dc:creator>
      <dc:date>2020-02-20T13:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: ActionExecution + I18NUtil - messages are not included</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86477#M26137</link>
      <description>&lt;P&gt;Your problem probably has to do with the lack of the proper Locale in the context of I18nUtil. When you run an action in synchronous mode, the action and I18nUtil inherit the Locale context from the request thread, which typically is associated with the Locale as provided by the client browser. This context is not carried over to asynchronous actions, and as such, the I18nUtil may try to look up messages in different locales from the ones for which you have provided message bundles, and thus not find any matches.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 13:57:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86477#M26137</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2020-02-20T13:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: ActionExecution + I18NUtil - messages are not included</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86478#M26138</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Yeah, we though this aswell. But it seems that the I18NUtil is able to get proper Locale (messageService.getLocale() returns exact Locale from request header) even in asynchronous action.&lt;/P&gt;&lt;P&gt;SOLVED: so, we have played with this a little bit. Just try/error style.&lt;/P&gt;&lt;P&gt;Register bundles as:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;bean &lt;/SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;SPAN&gt;="resourceBundles" &lt;/SPAN&gt;&lt;SPAN&gt;class&lt;/SPAN&gt;&lt;SPAN&gt;="org.alfresco.i18n.ResourceBundleBootstrapComponent"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;property &lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;="resourceBundles"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            &amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;alfresco.module.${project.artifactId}.messages.customAction&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;list&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;property&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;bean&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;seems to solve this problem. It looks like bundles are loaded differentyl from&amp;nbsp;dictionaryBootstrap. The messages was really not cached in I18NUtil in asynchronous context.&lt;/P&gt;&lt;P&gt;Do not know if this is bug or not.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 14:22:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86478#M26138</guid>
      <dc:creator>p31r</dc:creator>
      <dc:date>2020-02-20T14:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: ActionExecution + I18NUtil - messages are not included</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86479#M26139</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/76427"&gt;@p31r&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Glad to see you got it sorted - thanks also for reporting the solution, really helpful for others ecountering similar problems.&lt;/P&gt;
&lt;P&gt;Best wishes,&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 14:56:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/actionexecution-i18nutil-messages-are-not-included/m-p/86479#M26139</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-02-20T14:56:36Z</dc:date>
    </item>
  </channel>
</rss>

