helper?
For example, if I have this translation defined in my YAML file
en:
contact_page:
title: Contact us
phones:
- (123) 456-7890
- +1987654321
- 1-890-123-456
Then in my view, how can I get to international phone number (second
array item) directly?
I tried all of following, but non of them works.
<%= t 'contact_page.phones[1]' %>
<%= t 'contact_page.phones.1' %>
<%= t 'contact_page.phones.[1]' %>
Some google results suggest first form should work, but it doesn't
work for me. However, code below does work as it should, but its a bit
cumbersome to use, so I was hoping there is a way to get to array
elements directly by specifying their index in the string identifier
somehow.
<%= t('contact_page.phones')[1] %>
Thanks for your help!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.