Permalink
Browse files

add scope to routes.yml to avoid conflicts with other routes from the…

… app
  • Loading branch information...
1 parent 9fe0f1a commit cf0e283f81347ec9bd6fb9508aa1839323f14760 @francesc committed Jun 20, 2012
Showing with 9 additions and 5 deletions.
  1. +8 −4 README.rdoc
  2. +1 −1 lib/rails-translate-routes.rb
View
@@ -1,5 +1,7 @@
= rails-translate-routes
+Important change from version 0.0.5 (Feb 2012) to 0.1.0 (June 2012): if you're updating from an earlier version take into account that now translations defined in routes.yml are namespaced to avoid conflicts with other translations from app (thanks to cawel for the patch). To upgrade you just have to add the namespace 'routes' to your routes.yml (see example in the below docs).
+
Rails >=3.1 routes translations based on Raul's translate_routes (https://github.com/raul/translate_routes).
It's currently a stripped down version of the forked gem, adding some bugfixes for rails 3.1 and features I needed for my project. See doc below to see what it can do.
@@ -41,11 +43,13 @@ We want to have them in two languages english and spanish, to accomplish this wi
2) Now we can write translations on a standard YAML file (e.g: in config/locales/routes.yml), including all the locales and their translations:
en:
- # you can leave empty locales, for example the default one
+ routes:
+ # you can leave empty locales, for example the default one
es:
- products: productos
- contact: contacto
- new: crear
+ routes:
+ products: productos
+ contact: contacto
+ new: crear
3) Include this filter in your ApplicationController:
@@ -117,7 +117,7 @@ def load_dictionary_from_file file_path
def add_dictionary_from_file file_path
yaml = YAML.load_file(file_path)
yaml.each_pair do |locale, translations|
- merge_translations locale, translations
+ merge_translations locale, translations['routes']
end
set_available_locales_from_dictionary
end

0 comments on commit cf0e283

Please sign in to comment.