【问题标题】:Do I still need to use third party gem for localized URI in rail?我是否仍需要使用第三方 gem 来实现铁路中的本地化 URI?
【发布时间】:2012-10-12 10:27:56
【问题描述】:

过去我们需要使用https://github.com/kwi/i18n_routing等其他模块,现在还是首选吗?

我只想要一些基本的 URI 映射,例如

http://www.example.com/users/1 (default)
http://www.example.com/es/users/1 
http://www.example.com/jp/users/1 

【问题讨论】:

    标签: ruby-on-rails ruby localization internationalization


    【解决方案1】:

    不是真的。

    您可以像这样设置语言环境前缀。

     scope "(:locale)", :locale => /en|de|hr/ do
        get "foo/bar"
      end
    

    这匹配:

    • /foo/bar
    • /en/foo/bar
    • /de/foo/bar
    • /hr/foo/bar

    【讨论】:

      猜你喜欢
      • 2017-02-27
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 2020-01-07
      • 2021-01-18
      • 1970-01-01
      相关资源
      最近更新 更多