开发者

Grails set language (internationalization) via URL mappin

开发者 https://www.devze.com 2022-12-17 13:50 出处:网络
I\'m interested in supporting English and French in my Grails app with user-friendly URL. format: /appname/language/controller/action

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开发者_Python百科 is the best way without passing as a parameter (?lang=fr) then rewriting the URL.

Thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消