掲示板

Resource.properties and SocialActivityInterpreter

thumbnail
11年前 に Philipp Schwarz によって更新されました。

Resource.properties and SocialActivityInterpreter

Junior Member 投稿: 29 参加年月日: 12/10/19 最新の投稿
Hey folks,

my JSPs seem to pick up the resource bundle located in /WEB-INF/src with the corresponding entry in the portlet.xml just fine. However I'm stuck translating messages from within my SocialActivityInterpreter class.

For example:
activity-books-added-book-in={0} added a new {1} in {2}.

in my Resource.properties file should turn up in the Activity Portlet as:
"Phil added a new Book in Pragmatic Reviews.".

This is what I've tried so far:
String pattern = "activity-books-added-book-in";
String message = themeDisplay.translate(pattern, new Object[] {userName, text, groupName});

and
String pattern = "activity-books-added-book-in";
String message = MessageFormat.format(pattern, new Object[] {userName, text, groupName});


userName, text and groupName are correctly populated, but all that ever shows up in the Activity Portlet is "activity-books-added-book-in" and a Date/Time.

I've looked here and here but none of the solutions worked for me. Adding <supported-locale> to the portlet.xml and a locale resource file didn't help either. I also double checked my key/value pairs in the resouce file, they are correct.

How do I get the Interpreter class to pick up my resource bundle?

cheers,
phil

P.S.
LP is v6.1 CE GA2
thumbnail
11年前 に Philipp Schwarz によって更新されました。

RE: Resource.properties and SocialActivityInterpreter

Junior Member 投稿: 29 参加年月日: 12/10/19 最新の投稿
Update:

I've worked my way around the problem by creating a hook to override the liferay language bundle.

It works but on the downside I now have to throw all messages into a single property file instead of having a separate resource bundle for each portlet. And since I'm German this goes against my distinct preference for neat orderliness. emoticon

Besides I'm not really sure if that's "the right way" to do this so any other applicable solution is most appreciated. emoticon

So long,
phil