Forum: Rails I18n is there a way to add to an array from multiple files?

E95f906d1c0b54495bb4685b24569ec3?d=identicon&s=25 patrick99e99 (Guest)
on 2011-11-02 00:18
(Received via mailing list)
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
B641ba9f25e3ed00298d7643d89757e8?d=identicon&s=25 Ratnadeep Deshmane (Guest)
on 2011-11-02 06:10
(Received via mailing list)
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.

On Wed, Nov 2, 2011 at 4:47 AM, patrick99e99 <patrick99e99@gmail.com>
wrote:

>      - baz
> To unsubscribe from this group, send email to
> rails-i18n+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rails-i18n?hl=en.
>
>


--
Ratnadeep Deshmane.
http://rtdptech.com
4becbaa02e73aaff17653afc7256460d?d=identicon&s=25 Christopher Dell (tigrish)
on 2011-11-02 10:14
(Received via mailing list)
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.
This topic is locked and can not be replied to.