Fórum

Resource.properties and SocialActivityInterpreter

thumbnail
Philipp Schwarz, modificado 11 Anos atrás.

Resource.properties and SocialActivityInterpreter

Junior Member Postagens: 29 Data de Entrada: 19/10/12 Postagens Recentes
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
Philipp Schwarz, modificado 11 Anos atrás.

RE: Resource.properties and SocialActivityInterpreter

Junior Member Postagens: 29 Data de Entrada: 19/10/12 Postagens Recentes
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