I have a Usercontroller and I want to display a message to our user when his user name or password is incorrectly and I want to show different language depend on the user's location.here is the code:
if(user){
session.userId=user.userId
def redirectParams=session.originalRequestParams?session.originalRequestParams:[controler:'race']
redirect(redirectParams)
}else{
//for now,it's a hard-code pattern.
flash['message']='Please enter a valid user id and password'
}
following we should do is add something in my message.propertis file.
in the file:grails-app/i18n/messages.properties we added English message
user.invilate.message=Please enter a valid user id and password
in the file:grails-app/i18n/messages_de.properties we added German message
user.invilate.message=Bitte geben Sie eine gültige Benutzer-ID und Passwort
then we change above code
flash['message']='${message(code:'user.invilate.message')}'
3 comments:
Hey!
Thanks for the post!
Actually now you can also call message without "${...}"!
kind regards,
flo
Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!
Hi, if you don;t mind, may I ask how to autodetect client browser region settings in a grails application?
Hope for your reply. tnx a lot. :)
Post a Comment