Chack
unread,Apr 1, 2011, 3:48:00 PM4/1/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to I18n Routing
Hello,
I have a problem translating a match route in rails 3.0.3. The
something match route just wont get translated. I tried everything
possible, upgrading to 3.0.5, get instead of match, different quotes,
no quotes, no :as, :as => :something etc etc. As you can see
translations are working for routes, just not for the match.
Any idea why it isnt working is greatly apreciated.
#routes.rb
Multilang::Application.routes.draw do
scope "(:locale)", :locale => /en|de/ do
localized(I18n.available_locales, :verbose => true) do
match 'something', :to => 'projects#index', :as => 'something'
resources :projects, :only => [:index]
resources :users, :only => [:show]
root :to => 'home#index'
end
end
end
#de.yml
de:
hello: Hallo world
path_names:
new: neu
edit: bearbeiten
named_routes_path:
something: etwas
resources:
users: benutzer
projects: projekte
#rake routes
konstantin@localhost:~/Rails/multilang$ rake routes
(in /Users/konstantin/Rails/multilang)
[I18n] > localize resources : projects
(en) => /projects
[I18n] > localize resources : projects
(de) => /projekte
[I18n] > localize resources : projects
(fr) => /projets
[I18n] > localize resources : users
(de) => /benutzer
[I18n] > localize resources : users
(fr) => /membre
[I18n] > localize resources : projects
(en) => /projects
[I18n] > localize resources : projects
(de) => /projekte
[I18n] > localize resources : projects
(fr) => /projets
[I18n] > localize resources : users
(de) => /benutzer
[I18n] > localize resources : users
(fr) => /membre
something (/:locale)/something(.:format) {:locale=>/en|
de/, :action=>"index", :controller=>"projects"}
en_projects GET (/:locale)/projects(.:format)
{:i18n_locale=>"en", :locale=>/en|
de/, :action=>"index", :controller=>"projects"}
de_projects GET (/:locale)/projekte(.:format)
{:i18n_locale=>"de", :locale=>/en|
de/, :action=>"index", :controller=>"projects"}
fr_projects GET (/:locale)/projets(.:format)
{:i18n_locale=>"fr", :locale=>/en|
de/, :action=>"index", :controller=>"projects"}
projects GET (/:locale)/projects(.:format) {:locale=>/en|
de/, :action=>"index", :controller=>"projects"}
de_user GET (/:locale)/benutzer/:id(.:format)
{:i18n_locale=>"de", :locale=>/en|
de/, :action=>"show", :controller=>"users"}
fr_user GET (/:locale)/membre/:id(.:format)
{:i18n_locale=>"fr", :locale=>/en|
de/, :action=>"show", :controller=>"users"}
user GET (/:locale)/users/:id(.:format) {:locale=>/en|
de/, :action=>"show", :controller=>"users"}
root /(:locale)(.:format) {:locale=>/en|
de/, :controller=>"home", :action=>"index"}