Skip to content

Commit b8108c4

Browse files
committed
Replace I18n.t with t in views
Rails views already include an improved version of `I18n.t` via the module `ActionView::Helpers::TranslationHelper`.
1 parent 8ee0eeb commit b8108c4

17 files changed

Lines changed: 65 additions & 65 deletions

File tree

lib/views/backend/spree/admin/shared/_navigation_footer.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
<li data-hook="user-logout-link">
1717
<%= link_to spree.admin_logout_path, method: Devise.sign_out_via do %>
1818
<i class='fa fa-sign-out'></i>
19-
<%= I18n.t('spree.logout') %>
19+
<%= t('spree.logout') %>
2020
<% end %>
2121
</li>
2222

2323
<% if spree.respond_to? :root_path %>
2424
<li data-hook="store-frontend-link">
2525
<%= link_to spree.root_path, target: '_blank' do %>
2626
<i class='fa fa-external-link'></i>
27-
<%= I18n.t('spree.back_to_store') %>
27+
<%= t('spree.back_to_store') %>
2828
<% end %>
2929
</li>
3030
<% end %>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
2-
<h2><%= I18n.t('spree.change_my_password') %></h2>
2+
<h2><%= t('spree.change_my_password') %></h2>
33

44
<%= form_for @spree_user, as: :spree_user, url: spree.update_password_path, method: :put do |f| %>
55
<p>
6-
<%= f.label :password, I18n.t('spree.password') %><br />
6+
<%= f.label :password, t('spree.password') %><br />
77
<%= f.password_field :password %><br />
88
</p>
99
<p>
10-
<%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
10+
<%= f.label :password_confirmation, t('spree.confirm_password') %><br />
1111
<%= f.password_field :password_confirmation %><br />
1212
</p>
1313
<%= f.hidden_field :reset_password_token %>
14-
<%= f.submit I18n.t('spree.update'), class: 'button primary' %>
14+
<%= f.submit t('spree.update'), class: 'button primary' %>
1515
<% end %>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<div id="forgot-password">
2-
<h6><%= I18n.t('spree.forgot_password') %></h6>
2+
<h6><%= t('spree.forgot_password') %></h6>
33

4-
<p><%= I18n.t('spree.instructions_to_reset_password') %></p>
4+
<p><%= t('spree.instructions_to_reset_password') %></p>
55

66
<%= form_for Spree::User.new, as: :spree_user, url: spree.admin_reset_password_path do |f| %>
77
<p>
8-
<%= f.label :email, I18n.t('spree.email') %><br />
8+
<%= f.label :email, t('spree.email') %><br />
99
<%= f.email_field :email, required: true %>
1010
</p>
1111
<p>
12-
<%= f.submit I18n.t('spree.reset_password'), class: 'button primary' %>
12+
<%= f.submit t('spree.reset_password'), class: 'button primary' %>
1313
</p>
1414
<% end %>
1515
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div style="height:50px; padding-top:20px;">
2-
<strong><%= I18n.t('spree.authorization_failure') %></strong>
2+
<strong><%= t('spree.authorization_failure') %></strong>
33
</div>
44
<!-- Add your own custom access denied message here if you like -->

lib/views/backend/spree/admin/user_sessions/new.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44

55
<% @body_id = 'login' %>
66
<div id="existing-customer">
7-
<h6><%= I18n.t('spree.admin_login') %></h6>
7+
<h6><%= t('spree.admin_login') %></h6>
88
<div data-hook="login">
99
<%= form_for Spree::User.new, as: :spree_user, url: spree.admin_create_new_session_path do |f| %>
1010
<div id="password-credentials">
1111
<p>
12-
<%= f.label :email, I18n.t('spree.email') %><br />
12+
<%= f.label :email, t('spree.email') %><br />
1313
<%= f.email_field :email, class: 'title', tabindex: 1, autocomplete: 'username' %>
1414
</p>
1515
<p>
16-
<%= f.label :password, I18n.t('spree.password') %><br />
16+
<%= f.label :password, t('spree.password') %><br />
1717
<%= f.password_field :password, class: 'title', tabindex: 2, autocomplete: 'current-password' %>
1818
</p>
1919
</div>
2020
<p>
2121
<%= f.check_box :remember_me, tabindex: 3 %>
22-
<%= f.label :remember_me, I18n.t('spree.remember_me') %>
22+
<%= f.label :remember_me, t('spree.remember_me') %>
2323
</p>
2424

25-
<p><%= f.submit I18n.t('spree.login'), class: 'btn btn-primary', tabindex: 4 %></p>
25+
<p><%= f.submit t('spree.login'), class: 'btn btn-primary', tabindex: 4 %></p>
2626
<% end %>
27-
<%= I18n.t('spree.or') %>
28-
<%= link_to I18n.t('spree.forgot_password'), spree.admin_recover_password_path %>
27+
<%= t('spree.or') %>
28+
<%= link_to t('spree.forgot_password'), spree.admin_recover_password_path %>
2929
</div>
3030
</div>
3131
<div data-hook="login_extras"></div>

lib/views/backend/spree/layouts/admin/_login_nav.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<% if spree_current_user %>
22
<ul id="login-nav" class="inline-menu">
3-
<li data-hook="user-logged-in-as"><%= I18n.t('spree.logged_in_as') %>: <%= spree_current_user.email %></li>
4-
<li data-hook="user-account-link" class='fa fa-user'><%= link_to I18n.t('spree.account'), spree.edit_admin_user_path(spree_current_user) %></li>
5-
<li data-hook="user-logout-link" class='fa fa-sign-out'><%= link_to I18n.t('spree.logout'), spree.admin_logout_path %></li>
3+
<li data-hook="user-logged-in-as"><%= t('spree.logged_in_as') %>: <%= spree_current_user.email %></li>
4+
<li data-hook="user-account-link" class='fa fa-user'><%= link_to t('spree.account'), spree.edit_admin_user_path(spree_current_user) %></li>
5+
<li data-hook="user-logout-link" class='fa fa-sign-out'><%= link_to t('spree.logout'), spree.admin_logout_path %></li>
66

77
<% if spree.respond_to? :root_path %>
88
<li data-hook="store-frontend-link" class='fa fa-external-link'>
9-
<%= link_to I18n.t('spree.back_to_store'), spree.root_path, target: '_blank' %>
9+
<%= link_to t('spree.back_to_store'), spree.root_path, target: '_blank' %>
1010
</li>
1111
<% end %>
1212
</ul>

lib/views/frontend/spree/checkout/registration.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<%= render partial: 'spree/shared/error_messages', locals: { target: @user } %>
2-
<h1><%= I18n.t('spree.registration') %></h1>
2+
<h1><%= t('spree.registration') %></h1>
33
<div id="registration" data-hook>
44
<div id="account" class="columns alpha eight">
55
<%= render template: 'spree/user_sessions/new' %>
66
</div>
77
<% if Spree::Config[:allow_guest_checkout] %>
88
<div id="guest_checkout" data-hook class="columns omega eight">
9-
<h6><%= I18n.t('spree.guest_user_account') %></h6>
9+
<h6><%= t('spree.guest_user_account') %></h6>
1010
<% if flash[:registration_error] %>
1111
<div class='flash error'><%= flash[:registration_error] %></div>
1212
<% end %>
1313
<%= form_for @order, url: update_checkout_registration_path, method: :put, html: { id: 'checkout_form_registration' } do |f| %>
1414
<p>
15-
<%= f.label :email, I18n.t('spree.email') %><br />
15+
<%= f.label :email, t('spree.email') %><br />
1616
<%= f.email_field :email, class: 'title' %>
1717
</p>
18-
<p><%= f.submit I18n.t('spree.continue'), class: 'button primary' %></p>
18+
<p><%= f.submit t('spree.continue'), class: 'button primary' %></p>
1919
<% end %>
2020
</div>
2121
<% end %>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<%= form_for Spree::User.new, as: :spree_user, url: spree.create_new_session_path do |f| %>
22
<div id="password-credentials">
33
<p>
4-
<%= f.label :email, I18n.t('spree.email') %><br />
4+
<%= f.label :email, t('spree.email') %><br />
55
<%= f.email_field :email, class: 'title', tabindex: 1, autofocus: true %>
66
</p>
77
<p>
8-
<%= f.label :password, I18n.t('spree.password') %><br />
8+
<%= f.label :password, t('spree.password') %><br />
99
<%= f.password_field :password, class: 'title', tabindex: 2 %>
1010
</p>
1111
</div>
1212
<p>
1313
<%= f.check_box :remember_me, tabindex: 3 %>
14-
<%= f.label :remember_me, I18n.t('spree.remember_me') %>
14+
<%= f.label :remember_me, t('spree.remember_me') %>
1515
</p>
1616

17-
<p><%= f.submit I18n.t('spree.login'), class: 'button primary', tabindex: 4 %></p>
17+
<p><%= f.submit t('spree.login'), class: 'button primary', tabindex: 4 %></p>
1818
<% end %>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if spree_current_user %>
2-
<li><%= link_to I18n.t('spree.my_account'), spree.account_path %></li>
3-
<li><%= link_to I18n.t('spree.logout'), spree.logout_path, method: Devise.sign_out_via %></li>
2+
<li><%= link_to t('spree.my_account'), spree.account_path %></li>
3+
<li><%= link_to t('spree.logout'), spree.logout_path, method: Devise.sign_out_via %></li>
44
<% else %>
5-
<li id="link-to-login"><%= link_to I18n.t('spree.login'), spree.login_path %></li>
5+
<li id="link-to-login"><%= link_to t('spree.login'), spree.login_path %></li>
66
<% end %>

lib/views/frontend/spree/shared/_user_form.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<p>
2-
<%= f.label :email, I18n.t('spree.email') %><br />
2+
<%= f.label :email, t('spree.email') %><br />
33
<%= f.email_field :email, class: 'title' %>
44
</p>
55
<div id="password-credentials">
66
<p>
7-
<%= f.label :password, I18n.t('spree.password') %><br />
7+
<%= f.label :password, t('spree.password') %><br />
88
<%= f.password_field :password, class: 'title' %>
99
</p>
1010

1111
<p>
12-
<%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
12+
<%= f.label :password_confirmation, t('spree.confirm_password') %><br />
1313
<%= f.password_field :password_confirmation, class: 'title' %>
1414
</p>
1515
</div>

0 commit comments

Comments
 (0)