Skip to content
Browse files

Added more i8n translations on sign in and dashboard pages

  • Loading branch information...
1 parent 35f4989 commit bb83b09543881f5b504d4843a52464571052f267 Lee Smith committed
View
11 app/controllers/user_sessions_controller.rb
@@ -9,17 +9,18 @@ def new
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
- msg = "Welcome back <strong>#{@user_session.user.username}</strong>!"
+ #msg = "Welcome <strong>#{@user_session.user.username}</strong>!"
+ msg = t('welcome_on_login', :username => @user_session.user.username)
if @user_session.user.last_login_at
- msg = msg + "&nbsp;Your last login was on <strong>#{@user_session.user.last_login_at.strftime("%Y-%m-%d %I:%M %p")}</strong> from <strong>#{@user_session.user.last_login_ip}</strong>"
+ msg = msg + "&nbsp;" + t('login_details', :timestamp => @user_session.user.last_login_at.strftime("%Y-%m-%d %I:%M %p"), :ip => @user_session.user.last_login_ip)
end
flash[:success] = msg
redirect_back_or_default dashboard_index_path
else
if @user_session.being_brute_force_protected?
- flash[:error] = "User is locked: exceeded failed login limit!"
+ flash[:error] = t('locked_out')
else
- flash[:error] = "Invalid login attempt!"
+ flash[:error] = t('invalid_signin')
end
redirect_to login_path
end
@@ -27,7 +28,7 @@ def create
def destroy
current_user_session.destroy
- flash[:success] = "Logout successful!"
+ flash[:success] = t('logout')
redirect_back_or_default login_path
end
View
18 app/views/dashboard/index.html.erb
@@ -7,7 +7,7 @@
<h2>Dashboard</h2>
-<h3 class="toggle" id="active-tickets">Active Tickets</h3>
+<h3 class="toggle" id="active-tickets"><%=t '.active_tickets' -%></h3>
<div id="active-listing">
<table class="listing" cellspacing="0">
<thead>
@@ -39,7 +39,7 @@
</table>
</div>
-<h3 class="toggle" id="closed-tickets">Recently Closed Tickets</h3>
+<h3 class="toggle" id="closed-tickets"><%=t '.recently_closed_tickets' -%></h3>
<div id="closed-listing">
<table class="listing" cellspacing="0">
<thead>
@@ -71,32 +71,32 @@
</table>
</div>
-<h3 class="toggle" id="timeline-toggle">Timeline</h3>
+<h3 class="toggle" id="timeline-toggle"><%=t '.timeline' -%></h3>
<div id="timeline-wrapper">
<div class="timeline left">
<ul>
- <% @timeline.each_with_index do |t, i| -%>
+ <% @timeline.each_with_index do |day, i| -%>
<% ticket_count = @timeline_opened_tickets[@timeline[i]].blank? ? 0 : @timeline_opened_tickets[@timeline[i]] -%>
<li>
- <a href="#" title="<%= ticket_count -%> <%= ticket_count == 1 ? 'ticket' : 'tickets' -%> created on <%= t -%>" onclick="return false;">
+ <a href="#" title="<%= ticket_count -%> <%= ticket_count == 1 ? 'ticket' : 'tickets' -%> opened on <%= day -%>" onclick="return false;">
<span class="count" style="<%= ticket_count == 0 ? "height: 1px;" : ticket_count == @max_opened ? "height: 100%;" : (ticket_count.to_f/@max_opened)*100 < 1 ? "height: 1px;" : "height: #{(ticket_count.to_f/@max_opened)*100}%;" -%>"><%= ticket_count -%></span>
</a>
</li>
<% end -%>
</ul>
- <span class="timeline-label">Created Tickets</span>
+ <span class="timeline-label"><%=t '.opened_tickets' -%></span>
</div>
<div class="timeline right">
<ul>
- <% @timeline.each_with_index do |t, i| -%>
+ <% @timeline.each_with_index do |day, i| -%>
<% ticket_count = @timeline_closed_tickets[@timeline[i]].blank? ? 0 : @timeline_closed_tickets[@timeline[i]] -%>
<li>
- <a href="#" title="<%= ticket_count -%> <%= ticket_count == 1 ? 'ticket' : 'tickets' -%> closed on <%= t -%>" onclick="return false;">
+ <a href="#" title="<%= ticket_count -%> <%= ticket_count == 1 ? 'ticket' : 'tickets' -%> closed on <%= day -%>" onclick="return false;">
<span class="count" style="<%= ticket_count == 0 ? "height: 1px;" : ticket_count == @max_closed ? "height: 100%;" : (ticket_count.to_f/@max_closed)*100 < 1 ? "height: 1px;" : "height: #{(ticket_count.to_f/@max_closed)*100}%;" -%>"><%= ticket_count -%></span>
</a>
</li>
<% end -%>
</ul>
- <span class="timeline-label">Closed Tickets</span>
+ <span class="timeline-label"><%=t '.closed_tickets' -%></span>
</div>
</div>
View
4 app/views/password_resets/new.html.erb
@@ -1,14 +1,14 @@
<div id="login-content">
<h1><%=t 'reset_password' -%></h1>
<div class="box">
- <%= show_flash %>
+ <%= show_flash -%>
<p><%=t 'reset_instructions' -%></p>
<% form_tag password_resets_path do %>
<dl>
<dt><label for="email"><%=t 'email' -%></label></dt>
<dd><%= text_field_tag :email, {}, { :size => 20, :class => "textfield" } -%></dd>
- <dd><%= submit_tag t('button.submit'), :class => "button" %>&nbsp;&nbsp;<%= link_to t('cancel'), login_path %></dd>
+ <dd><%= submit_tag t('button.submit'), :class => "button" -%>&nbsp;&nbsp;<%= link_to t('cancel'), login_path -%></dd>
</dl>
<% end %>
</div>
View
17 app/views/user_sessions/new.html.erb
@@ -2,17 +2,16 @@
<h1><%=t 'sign_in' -%></h1>
<div class="box">
- <%= show_flash %>
- <% form_for @user_session, :url => user_session_path do |f| %>
+ <%= show_flash -%>
+ <% form_for @user_session, :url => user_session_path do |f| -%>
<dl>
- <dt><%= f.label :username %></dt>
- <dd><%= f.text_field :username, :size => 20, :class => "textfield" %></dd>
- <dt><%= f.label :password %></dt>
- <dd><%= f.password_field :password, :size => 20, :class => "textfield" %></dd>
- <dd><%= f.check_box :remember_me %><%= f.label :remember_me %></dd>
- <dd><%= f.submit t('sign_in'), :class => "button" %>&nbsp;&nbsp;<%= link_to t('forgot_password'), new_password_reset_path %></dd>
+ <dt><label for="user_session_username"><%=t 'username' -%></label></dt>
+ <dd><%= f.text_field :username, :size => 20, :class => "textfield" -%></dd>
+ <dt><label for="user_session_password"><%=t 'password' -%></label></dt>
+ <dd><%= f.password_field :password, :size => 20, :class => "textfield" -%></dd>
+ <dd><%= f.check_box :remember_me -%><label for="user_session_remember_me"><%=t 'remember_me' -%></label></dd>
+ <dd><%= f.submit t('sign_in'), :class => "button" -%>&nbsp;&nbsp;<%= link_to t('forgot_password'), new_password_reset_path -%></dd>
</dl>
<% end %>
</div>
-
</div>
View
20 config/locales/en.yml
@@ -3,10 +3,12 @@ en:
signed_in_as: 'Signed in as'
sign_out: 'Sign out'
sign_in: 'Sign in'
+ remember_me: 'Remember me'
forgot_password: 'Forgot your password?'
reset_password: 'Reset Password'
reset_instructions: 'Enter your email address below and instructions to reset your password will be emailed to you.'
change_my_password: 'Change My Password'
+ username: 'Username'
password: 'Password'
confirm_password: 'Confirm password'
email: 'Email'
@@ -16,14 +18,32 @@ en:
enter_ticket_no: 'Enter a ticket number:'
cancel: 'Cancel'
+ # Flash messages
+ welcome_on_login: 'Welcome %{username}!'
+ login_details: 'You last signed in on <strong>%{timestamp}</strong> from <strong>%{ip}</strong>'
+ locked_out: 'User is locked: exceeded failed sign in limit!'
+ invalid_signin: 'Invalid sign in attempt! Please try again.'
+ logout: 'Logout successful!'
+
+ # Buttons
button:
go: 'Go'
submit: 'Submit'
update: 'Update'
+ # Main tab menu
menu:
dashboard: 'Dashboard'
tickets: 'Tickets'
users: 'Users'
contacts: 'Contacts'
admin: 'Admin'
+
+ # Dashboard views
+ dashboard:
+ index:
+ active_tickets: 'Active Tickets'
+ recently_closed_tickets: 'Recently Closed Tickets'
+ timeline: 'Timeline'
+ opened_tickets: 'Opened Tickets'
+ closed_tickets: 'Closed Tickets'

0 comments on commit bb83b09

Please sign in to comment.
Something went wrong with that request. Please try again.