<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Portlet language ResourceBundle usage</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111595535" />
  <subtitle>Portlet language ResourceBundle usage</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111595535</id>
  <updated>2026-04-06T13:15:29Z</updated>
  <dc:date>2026-04-06T13:15:29Z</dc:date>
  <entry>
    <title>Portlet language ResourceBundle usage</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111595534" />
    <author>
      <name>Ervinas Marocka</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111595534</id>
    <updated>2018-11-19T13:09:48Z</updated>
    <published>2018-11-19T13:09:48Z</published>
    <summary type="html">&lt;p&gt;Hello, I have a WAR file with many portlets inside (migrated from
  older Liferay version) and I want to use a different translation file
  for each of the portlets but it does not seem to work in Liferay 7.0
  CE GA7. I have indicated &amp;lt;supported-locale&amp;gt; and
  &amp;lt;resource-bundle&amp;gt; tags in portlet.xml file, however, only one of
  the portlets is translated when using &amp;lt;liferay-ui:message&amp;gt; tags.
  The keys are displayed for the other portlets. I have tried to debug
  the code and found out that
  com.liferay.taglib.util.TagResourceBundleUtil class loads the same
  ResourceBundle for all portlets. It seems that it picks up the first
  OSGi ResourceBundleLoader service of the bundle. I have listed the
  ResourceBundleLoader services in Felix Gogo shell using this command:
  services | grep 'servlet.context.name=my-portlets, resource.bundle.base.name'.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If I assign 'null' to 'resourceBundleLoader' variable in the code
  snippet below from the TagResourceBundleUtil class using a debugger,
  the keys are translated. Am I missing something or is there a bug? I
  am just starting to use Liferay.&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;public static ResourceBundle getResourceBundle(&lt;/p&gt;
&lt;p&gt;HttpServletRequest request, Locale locale) {&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;ResourceBundleLoader resourceBundleLoader = getResourceBundleLoader(&lt;/p&gt;
&lt;p&gt;request); //Gets the first ResourceBundleLoader of the bundle. If I
  assign it to 'null' using a debugger, the keys are translated.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;if (resourceBundleLoader != null) {&lt;/p&gt;
&lt;p&gt;return resourceBundleLoader.loadResourceBundle(locale);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;ResourceBundle portletResourceBundle = getPortletResourceBundle(&lt;/p&gt;
&lt;p&gt;request, locale);&lt;/p&gt;</summary>
    <dc:creator>Ervinas Marocka</dc:creator>
    <dc:date>2018-11-19T13:09:48Z</dc:date>
  </entry>
</feed>
