R – Grails set language (internationalization) via URL mappin

grailsinternationalizationurl

I'm interested in supporting English and French in my Grails app with user-friendly URL.

format: /appname/language/controller/action

example: /store/en/product/list

What is the best way without passing as a parameter (?lang=fr) then rewriting the URL.

Thanks

Best Answer

Adding the following mapping in your appname\grails-app\conf\UrlMappings.groovy should do it.

"/$lang/$controller/$action?/$id?"{

}

See the URL mapping article on the grails website for details.