aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/i18n.txt
diff options
context:
space:
mode:
authorKarel Minarik <karmi@karmi.cz>2009-01-26 13:35:54 +0100
committerKarel Minarik <karmi@karmi.cz>2009-01-26 13:35:54 +0100
commitaae0bec4f6db00435e833f76b244757caa9626b8 (patch)
tree953b4f28acdcb22c7fc1e4e5187e5212efaae2e6 /railties/doc/guides/source/i18n.txt
parentde7100dcb6a155f3eb22b859adefbd0672d6d94c (diff)
downloadrails-aae0bec4f6db00435e833f76b244757caa9626b8.tar.gz
rails-aae0bec4f6db00435e833f76b244757caa9626b8.tar.bz2
rails-aae0bec4f6db00435e833f76b244757caa9626b8.zip
Clarifications for the i18n guide: descriptions of working with URLs like "/en/books"
Diffstat (limited to 'railties/doc/guides/source/i18n.txt')
-rw-r--r--railties/doc/guides/source/i18n.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/doc/guides/source/i18n.txt b/railties/doc/guides/source/i18n.txt
index 2ec28cd3d8..e3b3877760 100644
--- a/railties/doc/guides/source/i18n.txt
+++ b/railties/doc/guides/source/i18n.txt
@@ -265,7 +265,7 @@ Every helper method dependent on +url_for+ (eg. helpers for named routes like +r
You may be satisfied with this. It does impact the readability of URLs, though, when the locale "hangs" at the end of every URL in your application. Moreover, from the architectural standpoint, locale is usually hierarchically above the other parts of application domain: and URLs should reflect this.
-You probably want URLs look like this: +www.example.com/en/books+ versus +www.example.com/nl/books+. This is achievable with the over-riding +default_url_options+ strategy: you just have to set up your routes with http://api.rubyonrails.org/classes/ActionController/Resources.html#M000354[+path_prefix+] option in this way:
+You probably want URLs look like this: +www.example.com/en/books+ (which loads English locale) and +www.example.com/nl/books+ (which loads Netherlands locale). This is achievable with the "over-riding +default_url_options+" strategy from above: you just have to set up your routes with http://api.rubyonrails.org/classes/ActionController/Resources.html#M000354[+path_prefix+] option in this way:
[source, ruby]
-------------------------------------------------------
@@ -273,7 +273,7 @@ You probably want URLs look like this: +www.example.com/en/books+ versus +www.ex
map.resources :books, :path_prefix => '/:locale'
-------------------------------------------------------
-Now, when you call +books_path+ method you should get +"/en/books"+ (for the default locale). An URL like +http://localhost:3001/nl/books+ should load the Netherlands locale, then, and so on.
+Now, when you call +books_path+ method you should get +"/en/books"+ (for the default locale). An URL like +http://localhost:3001/nl/books+ should load the Netherlands locale, then, and following call to +books_path+ should return +"/nl/books"+ (because the locale changed).
Of course, you need to take special care of root URL (usually "homepage" or "dashboard") of your application. An URL like +http://localhost:3001/nl+ will not work automatically, because the +map.root :controller => "dashboard"+ declaration in your +routes.rb+ doesn't take locale into account. (And rightly so. There's only one "root" URL.)