Rails - RouteTranslator Gem - 生成太多语言

时间:2015-11-02 15:06:59

标签: ruby-on-rails ruby-on-rails-4

Rails的另一天...... 我试过这个RouteTranlsator Gem。我已经完成了从第1步到第4步的步骤,但是当我运行rake routes命令时。我看到rake为更多6种语言生成了路线!像fr,de,cs,nl,...但我本地化只有两种语言:en(英语)和hu(匈牙利语)。我没有为其他语言创建任何翻译.yml文件!

Rails.application.routes.draw do
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".
  localized do
    resources :partners
    resources :school_reviews, except: [:edit]
    resources :schools
    resources :events

    # Authentication
    devise_for :users, :controllers => { 
        omniauth_callbacks: "users/omniauth_callbacks", registrations: 'registrations'
    }
    devise_scope :user do
      get 'sign_up_with_school' => 'registrations#new_with_school', as: 'sign_up_with_school'
      post 'sign_up_with_school' => 'registrations#create_with_school', as: 'create_with_school'
    end
  end
end

我只定义了hu(匈牙利语)翻译: 胡:   路线:     新:uj     创建:letrehozas     编辑:szerkesztes     毁灭:托莱斯     合作伙伴:partnerek     school_reviews:iskolai_velemenyek     学校:iskolak     事件:esemnyek

也许其他一些宝石会导致更多6种语言? 如何禁用fr,de,cs和其他语言?

1 个答案:

答案 0 :(得分:0)

好的,我已经解决了。 必须在环境中添加此行。

config.i18n.available_locales = [:en, :hu]