Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Philipp Schwarz
Resource.properties and SocialActivityInterpreter
October 28, 2012 1:28 PM
Answer

Philipp Schwarz

Rank: Junior Member

Posts: 29

Join Date: October 19, 2012

Recent Posts

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:
1activity-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:
1String pattern = "activity-books-added-book-in";
2String message = themeDisplay.translate(pattern, new Object[] {userName, text, groupName});

and
1String pattern = "activity-books-added-book-in";
2String 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
Philipp Schwarz
RE: Resource.properties and SocialActivityInterpreter
October 28, 2012 1:30 PM
Answer

Philipp Schwarz

Rank: Junior Member

Posts: 29

Join Date: October 19, 2012

Recent Posts

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