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

In grails GSP, I want toolTip to be localized:

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

Since toolTip is written in the attribute header, I cannot use <g:message> here. Actually, I already have a service for localized messages, but when I call it from GSP, the serviceSource message is null, so getting this to work will also be a solution.

+4
source share
1 answer

You can directly call the tag:

 <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')}"> 
+12
source

Source: https://habr.com/ru/post/1313376/


All Articles