Andrey Yaskulsky
Andrey Yaskulsky

Reputation: 2516

Access process i18n property files before compilation

I have a following situation: in some of my i18n property files there are properties containing a special word:

I want to have a possibility of having a property somewhere in my Config.groovy that would contain a specific value for this specialword so that if I specify:

specialword=Value of special word

in a Config.groovy then I want my i18n properties to be resolved like:

for that purpose, when building the project, I want to access property files in order to look for occurences of specialword and to replace them with value of specialwordvalue from Config.groovy.

Is that possible somehow? Perhaps, someone faced similar situation? I would really appreciate any help. Thanks, Cheers

Upvotes: 0

Views: 32

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

Instead of trying to change the way the properties are compiled, you would be better off passing the special value as an argument to your message code (as discussed in the comments to your question).

For instance: <g:message code="my.key.code" args="[someVariableWithAValueFromConfig]" />

If your message code doesn't use the argument it will simply be ignored. This seems like the best approach to the problem you are trying to solve.

Upvotes: 1

Related Questions