6 test "linked lookup: if a key resolves to a symbol it looks up the symbol" do
7 I18n.backend.store_translations 'en', {
11 assert_equal 'linked', I18n.backend.translate('en', :link)
14 test "linked lookup: if a key resolves to a dot-separated symbol it looks up the symbol" do
15 I18n.backend.store_translations 'en', {
16 :link => :"foo.linked",
17 :foo => { :linked => 'linked' }
19 assert_equal('linked', I18n.backend.translate('en', :link))
22 test "linked lookup: if a dot-separated key resolves to a symbol it looks up the symbol" do
23 I18n.backend.store_translations 'en', {
24 :foo => { :link => :linked },
27 assert_equal('linked', I18n.backend.translate('en', :'foo.link'))
30 test "linked lookup: if a dot-separated key resolves to a dot-separated symbol it looks up the symbol" do
31 I18n.backend.store_translations 'en', {
32 :foo => { :link => :"bar.linked" },
33 :bar => { :linked => 'linked' }
35 assert_equal('linked', I18n.backend.translate('en', :'foo.link'))
38 test "linked lookup: links always refer to the absolute key" do
39 I18n.backend.store_translations 'en', {
40 :foo => { :link => :linked, :linked => 'linked in foo' },
41 :linked => 'linked absolutely'
43 assert_equal 'linked absolutely', I18n.backend.translate('en', :link, :scope => :foo)
46 test "linked lookup: a link can resolve to a namespace in the middle of a dot-separated key" do
47 I18n.backend.store_translations 'en', {
48 :activemodel => { :errors => { :messages => { :blank => "can't be blank" } } },
49 :activerecord => { :errors => { :messages => :"activemodel.errors.messages" } }
51 assert_equal "can't be blank", I18n.t(:"activerecord.errors.messages.blank")
52 assert_equal "can't be blank", I18n.t(:"activerecord.errors.messages.blank")