I18n多元化的孩子

时间:2016-01-18 23:25:55

标签: ruby-on-rails rails-i18n

所以我看到你可以轻易地复数。

parent:
    child:
        one: there were one!
        many: there were many!

I18n.t('parent.child', count: 1)

但是,如果你想让那些有多元化的孩子复杂化呢?

parent:
    child:
        foo:
            one: there was a foo!
            many: there were many foos!
        bar: a cool bar
        ...

我有一个看起来像

的丑陋方法
I18n.t('parent.child').merge( foo: I18n.t( 'parent.child.foo', count: 1 ) )

有更好的方法吗?

0 个答案:

没有答案