Friday, February 6, 2015

Groovy&Grails get the message resource properties values in service layer


import org.springframework.context.i18n.LocaleContextHolder

def messageSource

messageSource.getMessage('auto.update.zone.failed', null, LocaleContextHolder.locale)
def value =  ["test","test2"].toArray();
messageSource.getMessage('auto.update.zone.success.message',value , LocaleContextHolder.locale)

Messageresources.properties
auto.update.zone.failed=Auto update failed for newly approved zones

auto.update.zone.success.message=Successfully updated newly approved zones and loading took {0}  {1} ms.

No comments: