Skip to content

Commit

Permalink
I18n guide: Add warning about YAML sensitivity when storing translati…
Browse files Browse the repository at this point in the history
…on in YAML files, add info about better debugging when using Ruby files for translations: they crash your app during start-up. {i18n}

Cf. http://groups.google.com/group/rails-i18n/browse_thread/thread/28f7aff5b8bd8c4d/002edd9466500302?hl=en and many many more other people wondering what's wrong with their YAML.
  • Loading branch information
karmi committed Feb 2, 2009
1 parent d96483d commit 8cdfca1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions railties/doc/guides/source/i18n.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ image:images/i18n/demo_translated_pirate.png[rails i18n demo translated to pirat


NOTE: You need to restart the server when you add new locale files. 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 preffered option among Rails developers, has one big disadvantage, though. YAML is very sensitive to whitespace and special characters, so the application may not load your dictionary properly. Ruby files will crash your application during start-up time, 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 Ruby file.)

=== Adding Date/Time formats === Adding Date/Time formats


OK! Now let's add a timestamp to the view, so we can demo the *date/time localization* feature as well. To localize the time format you pass the Time object to +I18n.l+ or (preferably) use Rails' +#l+ helper. You can pick a format by passing the +:format+ option -- by default the +:default+ format is used. OK! Now let's add a timestamp to the view, so we can demo the *date/time localization* feature as well. To localize the time format you pass the Time object to +I18n.l+ or (preferably) use Rails' +#l+ helper. You can pick a format by passing the +:format+ option -- by default the +:default+ format is used.
Expand Down

0 comments on commit 8cdfca1

Please sign in to comment.