is there a way to add to an array from multiple files?

14 views
Skip to first unread message

patrick99e99

unread,
Nov 1, 2011, 7:17:32 PM11/1/11
to rails-i18n
say I have:
locales/file1.yml

en:
foo:
- bar

locales/file2.yml
en:
foo:
- baz

I want to be able to call t("foo") and get ["bar", "baz"].. Is there
any way to do this?

-patrick

Ratnadeep Deshmane

unread,
Nov 2, 2011, 1:09:11 AM11/2/11
to rails...@googlegroups.com
Yaml returns string only. So, I guess what you can do use 

foo:
  'bar baz'

and then f('foo').split(' ')

it's hack, but i don't see other option.


--
You received this message because you are subscribed to the Google Groups "rails-i18n" group.
To post to this group, send email to rails...@googlegroups.com.
To unsubscribe from this group, send email to rails-i18n+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rails-i18n?hl=en.




--
Ratnadeep Deshmane.
http://rtdptech.com

Christopher Dell

unread,
Nov 2, 2011, 5:13:01 AM11/2/11
to rails...@googlegroups.com
This should do it :

foo:
  - bar
  - baz


You can't keep each array entry in a separate file because you'll redefine the whole 'foo' scope every time.
Reply all
Reply to author
Forward
0 new messages