开发者

Generating urls dynamically in Ruby on Rails that may or maynot contain / in between

I am making a RoR site that is delivered in several languages, and want to change a part of the url by its language.

ex.

http://xxxx/en/index.html

http://xxxx/fr/index.html

I know I can do this via the route.rb

map.locale ':lang/index.html'

and designate the language when calli开发者_StackOverflowng this in view. However, there is an exception to this, when in the default language of the site, I want the url to be without the language identifier,

http://xxxx/index.html

as so.

Currently I cannot find a way to git rid of the / after the language identifier,

http://xxxx//index.html

is there a better way to do this?


It's not (yet) possible.
But you'll find some solution on this stackoverflow question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜