Skip to content

Commit

Permalink
copy edits 302e570
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Sep 20, 2011
1 parent ed1ada8 commit 5684ecf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions railties/guides/source/i18n.textile
Expand Up @@ -365,14 +365,13 @@ 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.) 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.)


h4. Passing variables into the translation h4. Passing variables to translations


You may use translation with parameters, if you want. You can use variables in the translation messages and pass their values from the view.


<ruby> <ruby>
# app/views/home/index.html.erb # app/views/home/index.html.erb
<h1><%=t 'greet_username', :user => "Bill", :message => "Goodbye" %></h1> <%=t 'greet_username', :user => "Bill", :message => "Goodbye" %>
<h1><%=t 'greet_username', :user => "DHH", :message => "Hello" %></h1>


# config/locales/en.yml # config/locales/en.yml
en: en:
Expand Down

0 comments on commit 5684ecf

Please sign in to comment.