aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/i18n.textile
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-04-15 10:37:43 +0200
committerXavier Noria <fxn@hashref.com>2010-04-15 10:37:43 +0200
commit19fa272b52e9028da358a45c5a152f3d58ddfd28 (patch)
tree2e2e235cd38d0dcc282c752e2eca3e5799660e4d /railties/guides/source/i18n.textile
parent002da9b6eab67323270dc8e7ea34fe72b3397b98 (diff)
downloadrails-19fa272b52e9028da358a45c5a152f3d58ddfd28.tar.gz
rails-19fa272b52e9028da358a45c5a152f3d58ddfd28.tar.bz2
rails-19fa272b52e9028da358a45c5a152f3d58ddfd28.zip
Revert "I18n guide: change ActionController by Action Controller in some places and fix code example in 2.4 section"
This reverts commit 002da9b6eab67323270dc8e7ea34fe72b3397b98.
Diffstat (limited to 'railties/guides/source/i18n.textile')
-rw-r--r--railties/guides/source/i18n.textile8
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/guides/source/i18n.textile b/railties/guides/source/i18n.textile
index ebc2790c3a..01e3380ee4 100644
--- a/railties/guides/source/i18n.textile
+++ b/railties/guides/source/i18n.textile
@@ -129,7 +129,7 @@ However, you would probably like to *provide support for more locales* in your a
WARNING: You may be tempted to store the chosen locale in a _session_ or a _cookie_. *Do not do so*. The locale should be transparent and a part of the URL. This way you don't break people's basic assumptions about the web itself: if you send a URL of some page to a friend, she should see the same page, same content. A fancy word for this would be that you're being "_RESTful_":http://en.wikipedia.org/wiki/Representational_State_Transfer. Read more about the RESTful approach in "Stefan Tilkov's articles":http://www.infoq.com/articles/rest-introduction. There may be some exceptions to this rule, which are discussed below.
-The _setting part_ is easy. You can set the locale in a +before_filter+ in the Application Controller like this:
+The _setting part_ is easy. You can set the locale in a +before_filter+ in the ApplicationController like this:
<ruby>
before_filter :set_locale
@@ -152,7 +152,7 @@ One option you have is to set the locale from the domain name where your applica
* It is very trivial to implement in Rails.
* Search engines seem to like that content in different languages lives at different, inter-linked domains.
-You can implement it like this in your Application Controller:
+You can implement it like this in your +ApplicationController+:
<ruby>
before_filter :set_locale
@@ -167,7 +167,7 @@ end
# 127.0.0.1 application.it
# 127.0.0.1 application.pl
# in your /etc/hosts file to try this out locally
-def extract_locale_from_uri
+def extract_locale_from_tld
parsed_locale = request.host.split('.').last
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
end
@@ -206,7 +206,7 @@ Getting the locale from +params+ and setting it accordingly is not hard; includi
Rails contains infrastructure for "centralizing dynamic decisions about the URLs" in its "+ApplicationController#default_url_options+":http://api.rubyonrails.org/classes/ActionController/Base.html#M000515, which is useful precisely in this scenario: it enables us to set "defaults" for "+url_for+":http://api.rubyonrails.org/classes/ActionController/Base.html#M000503 and helper methods dependent on it (by implementing/overriding this method).
-We can include something like this in our Application Controller then:
+We can include something like this in our ApplicationController then:
<ruby>
# app/controllers/application_controller.rb