Permalink
Browse files

Implement full internationalization.

  • Loading branch information...
1 parent 35b9791 commit 89d7c9cc19944406f40a6adbfa3a3deffb3045f0 @maxim maxim committed Sep 7, 2009
Showing with 252 additions and 96 deletions.
  1. +3 −0 lark_template.rb
  2. +3 −3 patterns/bluetrip/app/views/user_sessions/new.html.erb
  3. +3 −3 patterns/bluetrip/app/views/users/edit.html.erb
  4. +1 −1 patterns/default/app/controllers/accounts_controller.rb
  5. +3 −3 patterns/default/app/controllers/application_controller.rb
  6. +4 −8 patterns/default/app/controllers/password_resets_controller.rb
  7. +2 −2 patterns/default/app/controllers/user_sessions_controller.rb
  8. +2 −2 patterns/default/app/controllers/users_controller.rb
  9. +1 −1 patterns/default/app/helpers/application_helper.rb
  10. +1 −5 patterns/default/app/views/notifier/password_reset_instructions.html.erb
  11. +1 −7 patterns/default/app/views/notifier/welcome_email.html.erb
  12. +8 −8 patterns/default/app/views/pages/home.html.erb
  13. +2 −5 patterns/default/app/views/pages/upgrade.html.erb
  14. +2 −2 patterns/default/app/views/password_resets/edit.html.erb
  15. +3 −3 patterns/default/app/views/password_resets/new.html.erb
  16. +3 −3 patterns/default/app/views/user_sessions/new.html.erb
  17. +3 −3 patterns/default/app/views/users/edit.html.erb
  18. +6 −6 patterns/default/app/views/users/index.html.erb
  19. +2 −2 patterns/default/app/views/users/new.html.erb
  20. +10 −10 patterns/default/app/views/users/show.html.erb
  21. +175 −0 patterns/default/config/locales/en.yml
  22. +1 −1 patterns/require_activation/app/controllers/activations_controller.rb
  23. +3 −3 patterns/require_activation/app/views/activations/new.html.erb
  24. +1 −5 patterns/require_activation/app/views/notifier/activation_instructions.html.erb
  25. +1 −1 snippets/default/account_create_block
  26. +2 −2 snippets/default/ie6_blocking_ie6nomore_warning
  27. +1 −1 snippets/default/ie6_blocking_light_upgrade_test
  28. +1 −1 snippets/default/ie6_blocking_light_warning
  29. +0 −1 snippets/default/ie6_method
  30. +1 −1 snippets/default/user_create_block
  31. +1 −1 snippets/require_activation/account_create_block
  32. +1 −1 snippets/require_activation/activation_instructions_block
  33. +1 −1 snippets/require_activation/user_create_block
View
@@ -484,6 +484,9 @@ def install_rails (options)
file 'config/database.yml', load_pattern("config/database.#{database}.yml", 'default', binding)
file 'db/populate/01_sample_seed.rb', load_pattern('db/populate/01_sample_seed.rb')
+# locale
+file 'config/locales/en.yml', load_pattern('config/locale/en.yml', 'default', binding)
+
commit_state "configuration files"
# testing
@@ -1,12 +1,12 @@
<div id="main_without_left_menu" class="span-22 prefix-1 suffix-1 last">
- <h1>Login</h1>
+ <h1><%= t('.title') %></h1>
<% semantic_form_for @user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
<%= f.inputs :login, :password %>
<%= f.check_box :remember_me %>
- Remember Me <%= f.commit_button "Login" %>
+ <%= t('.remember_me') %> <%= f.commit_button t('label.login') %>
<% end %>
- <%= link_to "Register", register_path %>
+ <%= link_to t('link.register'), register_path %>
</div>
@@ -1,12 +1,12 @@
<div id="main_without_left_menu" class="span-22 prefix-1 suffix-1 last">
- <h1>Edit My Account</h1>
+ <h1><%= t('.title') %></h1>
<% semantic_form_for @user, :url => account_path, :live_validations => true do |f| %>
<%= f.error_messages %>
<%= render :partial => "users/form", :object => f %>
- <%= f.commit_button "Update"%>
+ <%= f.commit_button t('label.update') %>
<% end %>
- <br /><%= link_to "My Profile", account_path %>
+ <br /><%= link_to t('link.user'), account_path %>
</div>
@@ -22,7 +22,7 @@ def edit
def update
find_user
if @user.update_attributes(params[:user])
- flash[:notice] = "Account updated!"
+ flash[:notice] = t('flash.user_update_success')
redirect_to account_url
else
render :template => "users/edit"
@@ -22,7 +22,7 @@ def logged_in?
def admin_required
unless current_user && current_user.admin?
- flash[:error] = "Sorry, you don't have access to that."
+ flash[:error] = t("flash.require_admin")
redirect_to root_url and return false
end
end
@@ -45,7 +45,7 @@ def current_user
def require_user
unless current_user
store_location
- flash[:notice] = "You must be logged in to access this page"
+ flash[:notice] = t('flash.require_user')
redirect_to new_user_session_url
return false
end
@@ -54,7 +54,7 @@ def require_user
def require_no_user
if current_user
store_location
- flash[:notice] = "You must be logged out to access this page"
+ flash[:notice] = t('flash.require_no_user')
redirect_to account_url
return false
end
@@ -8,11 +8,10 @@ def create
@user = User.find_by_email(params[:email])
if @user
@user.deliver_password_reset_instructions!
- flash[:notice] = "Instructions to reset your password have been emailed to you. " +
- "Please check your email."
+ flash[:notice] = t('flash.password_instructions_sent')
redirect_to root_url
else
- flash[:notice] = "No user was found with that email address"
+ flash[:notice] = t('flash.email_not_found')
render :action => :new
end
end
@@ -24,7 +23,7 @@ def update
@user.password = params[:user][:password]
@user.password_confirmation = params[:user][:password_confirmation]
if @user.save
- flash[:notice] = "Password successfully updated"
+ flash[:notice] = t('flash.password_update_success')
redirect_to account_url
else
render :action => :edit
@@ -35,10 +34,7 @@ def update
def load_user_using_perishable_token
@user = User.find_using_perishable_token(params[:id])
unless @user
- flash[:notice] = "We're sorry, but we could not locate your account." +
- "If you are having issues try copying and pasting the URL " +
- "from your email into your browser or restarting the " +
- "reset password process."
+ flash[:notice] = t('flash.user_token_not_found')
redirect_to root_url
end
end
@@ -9,7 +9,7 @@ def new
def create
@user_session = UserSession.new(params[:user_session])
if @user_session.save
- flash[:success] = "Login successful!"
+ flash[:success] = t('flash.login_success')
redirect_back_or_default root_url
else
render :action => :new
@@ -18,7 +18,7 @@ def create
def destroy
current_user_session.destroy
- flash[:success] = "Logout successful!"
+ flash[:success] = t('flash.logout_success')
redirect_back_or_default new_user_session_url
end
end
@@ -24,7 +24,7 @@ def edit
def update
find_user
if @user.update_attributes(params[:user])
- flash[:notice] = "Account updated!"
+ flash[:notice] = t('flash.user_update_success')
redirect_to account_url
else
render :action => :edit
@@ -34,7 +34,7 @@ def update
def destroy
find_user
@user.destroy
- flash[:notice] = 'User was deleted.'
+ flash[:notice] = t('flash.user_destroy_success')
redirect_to(users_url)
end
@@ -27,7 +27,7 @@ def admin_only(&block)
end
def state_options
- [[ "Alabama", "AL" ], [ "Alaska", "AK" ], [ "Arizona", "AZ" ], [ "Arkansas", "AR" ], [ "California", "CA" ], [ "Colorado", "CO" ], [ "Connecticut", "CT" ], [ "Delaware", "DE" ], [ "District Of Columbia", "DC" ], [ "Florida", "FL" ], [ "Georgia", "GA" ], [ "Hawaii", "HI" ], [ "Idaho", "ID" ], [ "Illinois", "IL" ], [ "Indiana", "IN" ], [ "Iowa", "IA" ], [ "Kansas", "KS" ], [ "Kentucky", "KY" ], [ "Louisiana", "LA" ], [ "Maine", "ME" ], [ "Maryland", "MD" ], [ "Massachusetts", "MA" ], [ "Michigan", "MI" ], [ "Minnesota", "MN" ], [ "Mississippi", "MS" ], [ "Missouri", "MO" ], [ "Montana", "MT" ], [ "Nebraska", "NE" ], [ "Nevada", "NV" ], [ "New Hampshire", "NH" ], [ "New Jersey", "NJ" ], [ "New Mexico", "NM" ], [ "New York", "NY" ], [ "North Carolina", "NC" ], [ "North Dakota", "ND" ], [ "Ohio", "OH" ], [ "Oklahoma", "OK" ], [ "Oregon", "OR" ], [ "Pennsylvania", "PA" ], [ "Rhode Island", "RI" ], [ "South Carolina", "SC" ], [ "South Dakota", "SD" ], [ "Tennessee", "TN" ], [ "Texas", "TX" ], [ "Utah", "UT" ], [ "Vermont", "VT" ], [ "Virginia", "VA" ], [ "Washington", "WA" ], [ "West Virginia", "WV" ], [ "Wisconsin", "WI" ], [ "Wyoming", "WY" ]]
+ I18n.t('states').collect{|abbrev, full_name| [full_name.to_s, abbrev.to_s]}
end
def state_options_with_blank(label = "")
@@ -1,5 +1 @@
-A request to reset your password has been made. If you did not make this request, simply ignore this email. If you did make this request just click the link below:
-
-<%= @edit_password_reset_url %>
-
-If the above URL does not work try copying and pasting it into your browser. If you continue to have problem please feel free to contact us.
+<%= t('.text', :password_reset_url => @edit_password_reset_url) %>
@@ -1,7 +1 @@
-Welcome to #{current_app_name}!
-
-Thank you for creating an account at #{current_app_name}.
-
-Your login is <%= @user.login %>. You can log in to the site at <%= login_url %> .
-
-If you forget your password, you can visit <%= new_password_reset_url %> to reset it.
+<%= t('.text', :login => @user.login, :login_url => login_url, :password_reset_url => new_password_reset_url)%>
@@ -3,12 +3,12 @@
<% content_for :top_menu do %>
<div id="top_menu" class="#{top_menu_class}">
<% anonymous_only do %>
- <%= link_to "Register", new_account_path %>
- <%= link_to "Login", new_user_session_path %>
+ <%= link_to t('link.register'), new_account_path %>
+ <%= link_to t('link.login'), new_user_session_path %>
<% end %>
<% authenticated_only do %>
- <%= link_to "Logout", user_session_path, :method => :delete, :confirm => "Are you sure you want to logout?" %>
- <%= link_to "Your Account", account_path %>
+ <%= link_to t('link.logout'), user_session_path, :method => :delete, :confirm => t('flash.logout_confirmation') %>
+ <%= link_to t('link.user'), account_path %>
<% end %>
</div>
<% end %>
@@ -17,8 +17,8 @@
<div id="left_menu" class="#{left_menu_class}">
<ul>
<% anonymous_only do %>
- <li><%= link_to "Register", new_account_path %></li>
- <li><%= link_to "Login", new_user_session_path %></li>
+ <li><%= link_to t('link.register'), new_account_path %></li>
+ <li><%= link_to t('link.login'), new_user_session_path %></li>
<% end %>
<% authenticated_only do %>
<li><%= link_to "App menu item", "#" %></li>
@@ -29,10 +29,10 @@
</div>
<div id="main_with_left_menu" class="#{main_with_left_menu_class}">
- <h1>Welcome to #{current_app_name}</h1>
+ <h1><%= t('.welcome') %></h1>
<!--[if lt IE 7]>
<p class="flash_error">
- Your browser is obsolete. For best results in #{current_app_name}, please <%= link_to "Upgrade", pages_path(:action => 'upgrade'), :target => :blank %>
+ <%= t('ie.upgrade_message', :upgrade_page_url => link_to(t('link.upgrade'), pages_path(:action => 'upgrade'), :target => :blank) %>
</p>
<![endif]-->
@@ -1,5 +1,2 @@
-<div id="ie6msg">
-<h4>#{current_app_name} works best with a newer browser than you are using.</h4>
-<p>To get the best possible experience using #{current_app_name}, we recommend that you upgrade your browser to a newer version. The current version is <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">Internet Explorer 7</a> or <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx target="_blank"">Internet Explorer 8</a>. The upgrade is free. If you’re using a PC at work you should contact your IT-administrator. Either way, we'd like to encourage you to stop using IE6 and try a more secure and Web Standards-friendly browser.</p>
-<p>#{current_app_name} also supports other popular browsers like <strong><a href="http://getfirefox.com" target="_blank">Firefox</a></strong> or <strong><a href="http://www.opera.com" target="_blank">Opera</a></strong>.</p>
-</div>
+<% title t('ie.browser_obsolete'), false %>
+<%= t('.text') %>
@@ -1,7 +1,7 @@
-<% title 'Change My Password' %>
+<% title t('.title') %>
<% semantic_form_for @user, :url => password_reset_path, :method => :put, :live_validations => true do |f| %>
<%= f.error_messages %>
<%= f.input :password, :password_confirmation %>
- <%= f.commit_button "Update my password and log me in" %>
+ <%= f.commit_button t(".submit") %>
<% end %>
@@ -1,11 +1,11 @@
-<% title "Forgot Password?" %>
+<% title t('.title') %>
Fill out the form below and instructions to reset your password will be emailed to you:<br />
<br />
<% form_tag password_resets_path do %>
- <label>Email:</label><br />
+ <%= label_tag "email", t('labels.email') %><br />
<%= text_field_tag "email" %><br />
<br />
- <%= submit_tag "Reset my password" %>
+ <%= submit_tag t(".submit") %>
<% end %>
@@ -1,9 +1,9 @@
-<% title "Login" %>
+<% title t('.title') %>
<% semantic_form_for @user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
<%= f.inputs :login, :password %>
<%= f.check_box :remember_me %>
- Remember Me <%= f.commit_button "Login" %>
+ <%= t('.remember_me') %> <%= f.commit_button t('label.login') %>
<% end %>
-<%= link_to "Register", register_path %>
+<%= link_to t('link.register'), register_path %>
@@ -1,9 +1,9 @@
-<% title "Edit My Account" %>
+<% title t('.title') %>
<% semantic_form_for @user, :url => account_path, :live_validations => true do |f| %>
<%= f.error_messages %>
<%= render :partial => "users/form", :object => f %>
- <%= f.commit_button "Update"%>
+ <%= f.commit_button t('label.update') %>
<% end %>
-<br /><%= link_to "My Profile", account_path %>
+<br /><%= link_to t('link.user'), account_path %>
@@ -1,21 +1,21 @@
-<% title "All Users" %>
+<% title t(".title") %>
<table>
<tr>
- <th>Login</th>
+ <th><%= t('label.login') %></th>
<th colspan="3"></th>
</tr>
<% @users.each do |user| %>
<tr>
<td><%=h user.login %></td>
- <td><%= link_to 'Show', user %></td>
- <td><%= link_to 'Edit', edit_user_path(user) %></td>
- <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
+ <td><%= link_to t('link.show'), user %></td>
+ <td><%= link_to t('link.edit'), edit_user_path(user) %></td>
+ <td><%= link_to t('link.destroy'), user, :confirm => t('flash.destroy_confirmation'), :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
-<%= link_to 'New user', new_user_path %>
+<%= link_to t('link.new_user'), new_user_path %>
@@ -1,7 +1,7 @@
-<% title "Register" %>
+<% title t('.title') %>
<% semantic_form_for @user, :url => account_path, :live_validations => true do |f| %>
<%= f.error_messages %>
<%= render :partial => "users/form", :object => f %>
- <%= f.commit_button "Register" %>
+ <%= f.commit_button t('label.register') %>
<% end %>
@@ -1,45 +1,45 @@
-<% title "My Account" %>
+<% title t('.title') %>
<p>
- <b>Login:</b>
+ <b><%= User.human_attribute_name('login') %>:</b>
<%=h @user.login %>
</p>
<p>
- <b>Email:</b>
+ <b><%= User.human_attribute_name('email') %>:</b>
<%=h @user.email %>
</p>
<% admin_only do %>
<p>
- <b>Login count:</b>
+ <b><%= User.human_attribute_name('login_count') %>:</b>
<%=h @user.login_count %>
</p>
<p>
- <b>Last request at:</b>
+ <b><%= User.human_attribute_name('last_request_at') %>:</b>
<%=h @user.last_request_at %>
</p>
<p>
- <b>Last login at:</b>
+ <b><%= User.human_attribute_name('last_login_at') %>:</b>
<%=h @user.last_login_at %>
</p>
<p>
- <b>Current login at:</b>
+ <b><%= User.human_attribute_name('current_login_at') %>:</b>
<%=h @user.current_login_at %>
</p>
<p>
- <b>Last login ip:</b>
+ <b><%= User.human_attribute_name('last_login_ip') %>:</b>
<%=h @user.last_login_ip %>
</p>
<p>
- <b>Current login ip:</b>
+ <b><%= User.human_attribute_name('current_login_ip') %>:</b>
<%=h @user.current_login_ip %>
</p>
<% end %>
-<%= link_to 'Edit', edit_account_path %>
+<%= link_to t('link.edit'), edit_account_path %>
Oops, something went wrong.

0 comments on commit 89d7c9c

Please sign in to comment.