i18n a list
thanks to Henrik Nyh's blog
en:
steps: |
do this
do that
do this again
the key is the bar character '|', and can't use double quotes "" in this case
<ul>
<% t('steps').each_line do |step| %>
<li><%= step %></li>
<% end %>
</ul>
Written by Jin
Related protips
3 Responses
IMHO better idea is to use YAML array:
en:
steps:
- do this
- do that
- do this again
and then you can use it as an normal array:
<ul>
<%- t('steps').each do |step| -%>
<li><%= step %></li>
<%- end -%>
</ul>
over 1 year ago
·
@hauleth oh yes, i like your approach better
over 1 year ago
·
@hauleth how do you pass a %{variable} into one of this list item? i can't get this to work.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#