views:

229

answers:

2

Hi! I am using the help-balloons plugin I would like to use it parametrized. I mean, the messages should come from a properties file. In the documentation appears the following:

 <g:helpBalloon code="user.name" suffix=".help"/>

In this last example, the code attribute is used to look up the balloon's title within the message bundle and then the suffix is added to the code (producing user.name.help in our example) as the key to be used for looking up the content of the balloon.

My question is:

Where should be located this properties file (message bundle)?

Can I have one message bundle per controller?

Luis

+1  A: 

Where are the Resource bundles:

There is a directory under grails-app called i18n where all the generated resource files are placed, start looking there and see how they are used in the app.

You may be able to just place multiple message files for your controllers in there for organization, just be careful of reusing keys as I'm not sure how that will be handled off hand.

How to access them:

Maybe this will help I hope:

http://www.nabble.com/Organizing-message-bundles-tt16169280.html#a16169280

codeLes
Thanks for your answer. My question is how should be called this file.Luis
Luixv
I thought the question was: "Where should be located this properties file (message bundle)?" and then about 1 per controller. Maybe just a language barrier. Should we reword your question? re. how to call the file, I'll have to dig a little bit.
codeLes
+2  A: 

if you looked at the source code for the help balloon tag, it literally uses the grails interationalization code to render the message if given a key. http://fisheye.codehaus.org/browse/grails-plugins/grails-help-balloons/trunk/grails-app/taglib/HelpBalloonTagLib.groovy?r=45243

check out this page http://www.grails.org/doc/1.0.x/guide/10.%20Internationalization.html it tells you where and how to name the file for message bundles.

as for a message bundle per controller, it doesnt seem like you can (at least not apparent from the documentation). but you can hack it by prefixing the message key by the controller name, and thus use the same message bundle file (message.properties_ but still be able to namespace each message.

Chii
Great. This is the answer. Actually I've tried this but I didn't realize I had a syntax error and therefore the property didn't appear.
Luixv