Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a localized message in a grails GSP tag attribute?

In a grails GSP, I want a toolTip to be localized:

<a href="..." title="localizedMessage">

As the toolTip is written in the attribute title, I can't use <g:message> here. Actually I already have a service for localized messages, but when I call it from the GSP, the service's messageSource is null, so getting that to work would be a solution as well.

like image 641
Jörg Brenninkmeyer Avatar asked Dec 10 '22 15:12

Jörg Brenninkmeyer


1 Answers

You can invoke the tag directly:

<a href="..." title="${message(code:'your.localized.message.code')}">

I think this should work too:

<a href="..." title="${g.message(code:'your.localized.message.code')}">
like image 181
Daniel Engmann Avatar answered Dec 12 '22 04:12

Daniel Engmann