diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 80ab5e02..da4b5b89 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,9 +1,14 @@ class ApplicationController < ActionController::Base protect_from_forgery + before_filter :set_locale before_filter :force_approved_account before_filter :redirect_suspended_account + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end + def force_approved_account # We will redirect to the approval page if a user is signed in, is not an admin and is marked as waiting for approval redirect = user_signed_in? && !current_user.is_admin? && current_user.registration_status.waiting_approval? diff --git a/app/views/admin/admin/index.html.erb b/app/views/admin/admin/index.html.erb index f05a841b..5d4f7b01 100644 --- a/app/views/admin/admin/index.html.erb +++ b/app/views/admin/admin/index.html.erb @@ -8,19 +8,19 @@
-

Site settings

+

<%= t('admin.site_settings') %>

<%= form_for @settings, :url => admin_update_path, :method => :post do |f| %> <%= f.label :max_rooms do %> - Max number of rooms <%= f.number_field :max_rooms, :class => "input-mini pull-right" %> + <%= t('admin.max_number_of_rooms') %><%= f.number_field :max_rooms, :class => "input-mini pull-right" %> <% end %> <%= f.label :disable_conn_disconn_activity do %> - <%= f.check_box :disable_conn_disconn_activity, :class => "switch" %> disable connect/disconnect activity + <%= f.check_box :disable_conn_disconn_activity, :class => "switch" %><%= t('admin.disable_connect') %> <% end %> <%= f.label :public_site do %> - <%= f.check_box :public_site, :class => "switch" %> Public site + <%= f.check_box :public_site, :class => "switch" %> <%= t('admin.public_site') %> <% end %>

@@ -29,17 +29,17 @@ <% end %>

-

Users waiting for approval

+

<%= t('admin.users_waiting_approval') %>

All users

diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index b7ae403c..7a200303 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,4 +1,4 @@ -

Resend confirmation instructions

+

<%= t('devise.confirmations.resend_confirm.head') %>

<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> <%= devise_error_messages! %> @@ -6,7 +6,7 @@
<%= f.label :email %>
<%= f.email_field :email %>
-
<%= f.submit "Resend confirmation instructions" %>
+
<%= f.submit t('devise.confirmations.resend_confirm.button') %>
<% end %> -<%= render :partial => "devise/shared/links" %> \ No newline at end of file +<%= render :partial => "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index a6ea8ca1..548a529e 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,5 +1,5 @@

Welcome <%= @resource.email %>!

-

You can confirm your account through the link below:

+<%= t('devise.mailer.confirmation_instructions.message.html') %> -

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

+

<%= link_to t('devise.mailer.confirmation_instructions.message.link'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index 8489e53d..3e98408e 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -1,8 +1,7 @@

Hello <%= @resource.email %>!

-

Someone has requested a link to change your password, and you can do this through the link below.

+<%= t('devise.mailer.reset_password_instructions.message.html') %> -

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>

+

<%= link_to t(devise.mailer.reset_password_instructions.link'), edit_password_url(@resource, :reset_password_token => @token) %>

-

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

+<%= t('devise.mailer.reset_password_instructions.note.html') %> diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb index 2263c219..4bcf4f76 100644 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -1,7 +1,5 @@

Hello <%= @resource.email %>!

-

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

+<%= t('devise.mailer.unlock_instructions.message.html') %> -

Click the link below to unlock your account:

- -

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

+

<%= link_to t('devise.mailer.unlock_instructions.message.link'), unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index ae32fcc0..6a780e6e 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,20 +1,20 @@
-

Change your password

+

<%= t('devise.passwords.edit.head')

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> <%= devise_error_messages! %> <%= f.hidden_field :reset_password_token %>
- <%= f.label :password, "New password", :class => "control-label" %> + <%= f.label :password, t('devise.passwords.edit.new'), :class => "control-label" %> <%= f.password_field :password, :class => "form-control" %>
- <%= f.label :password_confirmation, "Confirm new password", :class => "control-label" %> + <%= f.label :password_confirmation, t('devise.passwords.edit.confirm'), :class => "control-label" %> <%= f.password_field :password_confirmation, :class => "form-control" %>
-

<%= f.submit "Change my password", :class => "btn btn-primary" %>

+

<%= f.submit t('devise.passwords.edit.submit'), :class => "btn btn-primary" %>

<% end %> -

<%= render :partial => "devise/shared/links" %>

\ No newline at end of file +

<%= render :partial => "devise/shared/links" %>

diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index e552ab31..b88a8646 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,12 +1,12 @@
-

Forgot Password?

+

<%= t('devise.passwords.new.head')

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> <%= devise_error_messages! %>
- <%= label_tag :email, "Email", :class => "control-label" %> + <%= label_tag :email, t('devise.passwords.new.email'), :class => "control-label" %> <%= f.text_field :email, :autofocus => true, :placeholder => 'jsmith@example.com', :class => "form-control" %>
-

<%= f.submit "Submit", :class => "btn btn-primary" %>

+

<%= f.submit t('devise.passwords.new.submit'), :class => "btn btn-primary" %>

<% end %>

<%= render :partial => "devise/shared/links" %>

diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 32257d2c..5a120635 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -4,45 +4,45 @@ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put , :role => "form"}) do |f| %>
-

Edit <%= resource_name.to_s.humanize %>

+

<%= t('devise.registrations.edit') %><%= resource_name.to_s.humanize %>

<%= devise_error_messages! %>
- <%= label_tag :first_name, "First Name", :class => "control-label" %> + <%= label_tag :first_name, t('devise.registrations.first_name'), :class => "control-label" %> <%= f.text_field :first_name, :class => "form-control", :placeholder => "John" %>
- <%= label_tag :last_name, "Last Name", :class => "control-label" %> + <%= label_tag :last_name, t('devise.registrations.last_name'), :class => "control-label" %> <%= f.text_field :last_name, :class => "form-control", :placeholder => "Smith" %>
- <%= label_tag :email, "Email", :class => "control-label" %> + <%= label_tag :email, t('devise.registrations.email'), :class => "control-label" %> <%= f.email_field :email, :class => "form-control", :placeholder => "jsmith@example.com" %>
- <%= label_tag :password, "Password", :class => "control-label" %> + <%= label_tag :password, t('devise.registrations.password'), :class => "control-label" %> <%= f.password_field :password , :placeholder => 'New Password', :class => "form-control" %>
(leave blank if you don't want to change it)
- <%= label_tag :password_confirmation, "Password Confirmation", :class => "control-label" %> + <%= label_tag :password_confirmation, t('devise.registrations.password_confirmation'), :class => "control-label" %> <%= f.password_field :password_confirmation, :class => "form-control", :placeholder => 'New Password Confirmation' %>
- <%= label_tag :avatar_url, "Avatar URL", :class => "control-label" %> + <%= label_tag :avatar_url, t('devise.registrations.avatar_url'), :class => "control-label" %> <%= f.url_field :avatar_url, :class => "form-control", :placeholder => 'http://www.gravatar.com/avatar/XXXXXXXXX' %>
(Avatar URL replaces your gravatar image)
- <%= label_tag :current_password, "Current Password", :class => "control-label" %> + <%= label_tag :current_password, t('devise.registrations.current_password'), :class => "control-label" %> <%= f.password_field :current_password, :class => "form-control", :placeholder => 'Current Password' %>
(Enter your current password to confirm your changes)

<%= link_to "Back", :back, :class => "btn btn-info" %> <%= f.submit "Update" , :class => "btn btn-primary" %>

-

Cancel My Account.

-

Unhappy with your service? We hate to see you go!

-

<%= link_to "Cancel my account", registration_path(resource_name), :class => "btn btn-danger", :confirm => "Are you sure you want to delete your account?", :method => :delete %>

+

<%= t('devise.registrations.cancel_account.head') %>

+ <%= t('devise.registrations.cancel_account.html') %> +

<%= link_to t('devise.registrations.cancel_account.link'), registration_path(resource_name), :class => "btn btn-danger", :confirm => "Are you sure you want to delete your account?", :method => :delete %>

<% end %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 75a08b73..73e1603e 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,32 +1,32 @@
-

Register an Account

+

<%= t('devise.registrations.register_account') %>

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> <%= devise_error_messages! %>
- <%= label_tag :first_name, "First Name", :class => "control-label" %> + <%= label_tag :first_name, t('devise.registrations.first_name'), :class => "control-label" %> <%= f.text_field :first_name, :class => "form-control", :placeholder => 'John' %>
- <%= label_tag :last_name, "Last Name", :class => "control-label" %> + <%= label_tag :last_name, t('devise.registrations.last_name'), :class => "control-label" %> <%= f.text_field :last_name, :class => "form-control", :placeholder => 'Smith' %>
- <%= label_tag :email, "Email", :class => "control-label" %> + <%= label_tag :email, t('devise.registrations.email'), :class => "control-label" %> <%= f.email_field :email, :class => "form-control", :placeholder => 'jsmith@example.com' %>
- <%= label_tag :password, "Username", :class => "control-label" %> + <%= label_tag :password, t('devise.registrations.username'), :class => "control-label" %> <%= f.text_field :username, :class => "form-control", :placeholder => 'jsmith' %>
- <%= label_tag :password, "Password", :class => "control-label" %> + <%= label_tag :password, t('devise.registrations.password'), :class => "control-label" %> <%= f.password_field :password, :class => "form-control", :placeholder => 'Something Memorable!' %>
- <%= label_tag :password, "Password Confirmation", :class => "control-label" %> + <%= label_tag :password, t('devise.registrations.password_confirmation'), :class => "control-label" %> <%= f.password_field :password_confirmation, :class => "form-control", :placeholder => 'Something Memorable!' %>
-

<%= f.submit "Register", :class => "btn btn-primary" %>

+

<%= f.submit t('devise.registrations.register'), :class => "btn btn-primary" %>

<% end %>

<%= render :partial => "devise/shared/links" %>

diff --git a/app/views/main/_sidebar.html.erb b/app/views/main/_sidebar.html.erb index 3601f807..81f9ebe1 100644 --- a/app/views/main/_sidebar.html.erb +++ b/app/views/main/_sidebar.html.erb @@ -5,10 +5,10 @@ <%= current_user.full_name_or_username %>
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 8235e2ba..3c2dcd82 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,18 +1,18 @@
-

Sign In

+

<%= t('sessions.title') %>

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :role => :form) do |f| %>
- <%= label_tag :username, "Username", :class => "control-label" %> + <%= label_tag :username, t('sessions.username'), :class => "control-label" %> <%= f.text_field :username, :autofocus => true, :placeholder => 'jsmith', :class => "form-control" %>
- <%= label_tag :password, "Password", :class => "control-label" %> + <%= label_tag :password, t('sessions.password'), :class => "control-label" %> <%= f.password_field :password, :class => "form-control"%>
- <%= f.submit "Sign in", :class => "btn btn-primary" %> + <%= f.submit t('sessions.submit'), :class => "btn btn-primary" %> <% end %> <%= render :partial => "devise/shared/links" %>
diff --git a/config/application.rb b/config/application.rb index 756e8c0a..93e450fc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -43,6 +43,9 @@ class Application < Rails::Application # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] + config.i18n.default_locale = :en + config.i18n.enforce_available_locales = true # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/config/locales/en.yml b/config/locales/en.yml deleted file mode 100644 index 7da9cf8a..00000000 --- a/config/locales/en.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" - activerecord: - errors: - models: - attachment: - attributes: - file: - spoofed_media_type: "Media Type Spoofed" diff --git a/config/locales/en/admin.en.yml b/config/locales/en/admin.en.yml new file mode 100644 index 00000000..12ea707f --- /dev/null +++ b/config/locales/en/admin.en.yml @@ -0,0 +1,9 @@ +en: + admin: + site_settings: "Site settings" + max_number_of_rooms: "Max number of rooms" + public_site: "Public site" + disable_connect: "disable connect/disconnect activity" + users_waiting_approval: "Users waiting for approval" + warn_no_user: "There are no users needing approval right now. Invite others to join Kandan!" + warn_no_approved_user: "There are no users. Invite others to join Kandan!" diff --git a/config/locales/devise.en.yml b/config/locales/en/devise.en.yml similarity index 67% rename from config/locales/devise.en.yml rename to config/locales/en/devise.en.yml index ec9a38df..88c1f3d0 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/en/devise.en.yml @@ -25,15 +25,42 @@ en: signed_in: 'Signed in successfully.' signed_out: 'Signed out successfully.' passwords: + new: + head: "Forgot Password?" + email: "Email" + submit: "Submit" + edit: + head: "Change your password" + new: "New password" + confirm: "Confirm new password" + submit: "Change my password" send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' updated: 'Your password was changed successfully. You are now signed in.' updated_not_active: 'Your password was changed successfully.' send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" confirmations: + resend_confirm: + head: "Resend confirmation instructions" + button: "Resend confirmation instructions" send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' confirmed: 'Your account was successfully confirmed. You are now signed in.' registrations: + register_account: "Register an Account" + first_name: "First Name" + last_name: "Last Name" + email: "Email" + username: "Username" + password: "Password" + password_confirmation: "Password Confirmation" + register: "Register" + edit: "Edit" + avatar_url: "Avatar URL" + current_password: "Current Password" + cancel_account: + head: "Cancel My Account." + html: "

Unhappy with your service? We hate to see you go!

" + link: "Cancel my account" signed_up: 'Welcome! You have signed up successfully.' updated: 'You updated your account successfully.' destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' @@ -50,7 +77,21 @@ en: mailer: confirmation_instructions: subject: 'Confirmation instructions' + message: + html: "

You can confirm your account through the link below:

" + link: "Confirm my account" reset_password_instructions: subject: 'Reset password instructions' + message: + html: "

Someone has requested a link to change your password, and you can do this through the link below.

" + note: + html: "

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

" + link: "Change my password" unlock_instructions: subject: 'Unlock Instructions' + message: + html: "

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

" + link: "Unlock my account" diff --git a/config/locales/en/main.en.yml b/config/locales/en/main.en.yml new file mode 100644 index 00000000..eca3a5a3 --- /dev/null +++ b/config/locales/en/main.en.yml @@ -0,0 +1,6 @@ +en: + main: + admin_console: "Admin console" + edit_account: "Edit Account" + logout: "Logout" + about_kandan: "About Kandan" diff --git a/config/locales/en/sessions.en.yml b/config/locales/en/sessions.en.yml new file mode 100644 index 00000000..6f8b65eb --- /dev/null +++ b/config/locales/en/sessions.en.yml @@ -0,0 +1,7 @@ +en: + sessions: + title: "Sign In" + username: "Username" + password: "Password" + rememberme: "Remember me" + submit: "Sign in"