syntax - grails i18n label cross-referencing? -



syntax - grails i18n label cross-referencing? -

is possible include i18n property values within other internationalized messages in grails?

i have domain class containing 2 properties, "mindelay" , "maxdelay", , want write internationalized message referencing labels both.

i wrote custom validator (maxdelay must bigger or equal mindelay):

maxdelay(validator:{ value, reference -> if (value < reference.mindelay) { homecoming ['custom.error', it] } else { homecoming true; } })

when fails, i'm printing property stub.maxdelay.custom.error.

in messages.properties there properties:

stub.maxdelay.custom.error=property [{0}] must bigger value of mindelay stub.mindelay.label=min. delay (ms) stub.maxdelay.label=max. delay (ms)

how can utilize value of stub.mindelay.label property instead of static text? error message should read like:

"property [max. delay (ms)] must bigger value of [min. delay (ms)]"

i've tried referencing {stub.mindelay.label} or ${stub.mindelay.label} parse error grails.

perhaps i'm approaching in wrong way, possible inject label via numeric parameter in validator? illustration if error message were:

stub.maxdelay.custom.error=property [{0}] must bigger value of [{1}]

note there 3rd parameter, of class org.springframework.validation.errors, can used fine-tuning error messages, like:

maxdelay(validator:{ value, reference, errors -> if (value < reference.mindelay) { errors.rejectvalue('maxdelay', 'stub.maxdelay.custom.error', [value, obj.mindelay], 'oops') } })

it work message:

stub.maxdelay.custom.error=property [{0}] must bigger value of [{1}]

grails syntax internationalization label

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -