aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2008-12-16 14:18:19 +0100
committerSven Fuchs <svenfuchs@artweb-design.de>2008-12-16 14:18:19 +0100
commitbf0ffc5486709017536f90a7af2626fa45801939 (patch)
tree4bade63c3aaf1e572a0ebad8e72923d17df358ae /railties
parentab757d8d75b9c47fc20373757ffa0168a87a83d0 (diff)
downloadrails-bf0ffc5486709017536f90a7af2626fa45801939.tar.gz
rails-bf0ffc5486709017536f90a7af2626fa45801939.tar.bz2
rails-bf0ffc5486709017536f90a7af2626fa45801939.zip
note about #t helper vs I18n.t
Diffstat (limited to 'railties')
-rw-r--r--railties/doc/guides/source/i18n.txt8
1 files changed, 3 insertions, 5 deletions
diff --git a/railties/doc/guides/source/i18n.txt b/railties/doc/guides/source/i18n.txt
index dc1b8cf8b3..f18e8b73a9 100644
--- a/railties/doc/guides/source/i18n.txt
+++ b/railties/doc/guides/source/i18n.txt
@@ -144,14 +144,12 @@ end
<p><%= flash[:notice] %></p>
-------------------------------------------------------
-TODO insert note about #t helper compared to I18n.t
-
-TODO insert note/reference about structuring translation keys
-
When you now render this view it will show an error message that tells you that the translations for the keys :hello_world and :hello_flash are missing.
TODO screenshot
+NOTE: Rails adds a +t+ (+translate+) helper method to your views so that you do not need to spell out +I18n.t+ all the time. Additionally this helper will catch missing translations and wrap the resulting error message into a &lt;span class="translation_missing"&gt;.
+
So let's add the missing translations (i.e. do the "localization" part):
[source, ruby]
@@ -237,7 +235,7 @@ I18n.t :missing, :default => 'Not here'
If the default value is a Symbol it will be used as a key and translated. One can provide multiple values as default. The first one that results in a value will be returned.
-E.g. the following first tries to translate the key :missing and then the key :also_missing. As both do not yield a result the string ‘Not here’ will be returned:
+E.g. the following first tries to translate the key :missing and then the key :also_missing. As both do not yield a result the string "Not here" will be returned:
[source, ruby]
-------------------------------------------------------