aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRich Seviora <richseviora@users.noreply.github.com>2017-01-29 14:51:05 -0800
committerrichseviora <richard.seviora@gmail.com>2017-01-30 15:02:01 -0800
commitd4ddf7b72f52597d0c0f90794cf52f6d0d687d4e (patch)
tree6ca558cb3fb7fac34e2e2a27fbeb604d049ba4b0 /guides
parent6a1c0218df1fcffaac97e7288db07934bfef277f (diff)
downloadrails-d4ddf7b72f52597d0c0f90794cf52f6d0d687d4e.tar.gz
rails-d4ddf7b72f52597d0c0f90794cf52f6d0d687d4e.tar.bz2
rails-d4ddf7b72f52597d0c0f90794cf52f6d0d687d4e.zip
Added warning for reserved YAML keywords.
Update i18n.md Addressed Feedback
Diffstat (limited to 'guides')
-rw-r--r--guides/source/i18n.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 4db6e3e195..0b7cc055be 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -409,6 +409,35 @@ NOTE: You need to restart the server when you add new locale files.
You may use YAML (`.yml`) or plain Ruby (`.rb`) files for storing your translations in SimpleStore. YAML is the preferred option among Rails developers. However, it has one big disadvantage. YAML is very sensitive to whitespace and special characters, so the application may not load your dictionary properly. Ruby files will crash your application on first request, so you may easily find what's wrong. (If you encounter any "weird issues" with YAML dictionaries, try putting the relevant portion of your dictionary into a Ruby file.)
+If your translations are stored in YAML files, certain keys must be escaped. They are:
+
+* true, on, yes
+* false, off, no
+
+Examples:
+
+```erb
+# confing/locales/en.yml
+en:
+ success:
+ 'true': 'True!'
+ 'on': 'On!'
+ 'false': 'False!'
+ failure:
+ true: 'True!'
+ off: 'Off!'
+ false: 'False!'
+```
+
+```ruby
+I18n.t 'success.true' # => 'True!'
+I18n.t 'success.on' # => 'On!'
+I18n.t 'success.false' # => 'False!'
+I18n.t 'failure.false' # => Translation Missing
+I18n.t 'failure.off' # => Translation Missing
+I18n.t 'failure.true' # => Translation Missing
+```
+
### Passing Variables to Translations
One key consideration for successfully internationalizing an application is to