svenfuchs/i18n — Issue #128: Wrong i18n resolution scope while using rspec for views
Author: emadridm
Created: 2011-12-08 15:12:11+00:00
State: open

Hi,

In the code bellow, when I use t('layouts.application.allrights') all works fine, but when I use t('.allrights') the "view spec" fails in that point; however, the page renders correctly in the browser.

I am using RoR 3.1 and rspec-rails 2.7. Any ideas?

the file views/layouts/application.html.haml is:

``` haml
!!! 5
%html
%head
%title= app_name
-# stylesheet
= render 'layouts/stylesheets'
-# javascript
= render 'layouts/javascripts'
= csrf_meta_tags
%body
.container
%header#page-header
%section#page-header-left
= app_logo
%section#page-header-right
= render 'layouts/signin_form'
#header-content= yield :header
%section#page-main
= yield
%footer#page-footer
%section#page-footer-top
#footer-content= yield :footer
%section#page-footer-left
= "#{app_author} #{t('layouts.application.allrights')} #{DateTime.now.year}"
%section#page-footer-right
%nav
= link_to t('.user_agreement'), "#"
= link_to t('.privacy_policy'), "#"
= link_to t('.copyright_policy'), "#"
```

the file /config/locales/views/layouts/en.yml is:

``` yaml
en:

layouts:

application:

allrights: "All rights reserved"
user_agreement: "User Agreement"
privacy_policy: "Privacy Policy"
copyright_policy: "Copyright Policy"

signin_form:

username: "email"
password: "password"
signin: "Sign in"
keepmesignedin: "keep me signed in"
forgotyourpass: "forgot your password?"
```