diff --git a/.gitignore b/.gitignore index 8e6a9798..f35b9ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,8 @@ # Ignore bundler config /.bundle -# Ingore Yardoc temp files and generated documentation +# Ingore Yardoc temp files /.yardoc -/doc # Ignore the default SQLite database. /db/*.sqlite3 diff --git a/Gemfile b/Gemfile index fbb5f9d2..216d5e76 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,6 @@ gem 'paperclip', '~> 4.2.0' gem 'rmagick', '2.13.4' gem 'aws-sdk', '~> 1.50' gem 'bcrypt', '~> 3.1.10', platforms: [:ruby, :mingw, :x64_mingw] -gem 'rails-i18n', '~> 4.0.0' group :production do gem 'less-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 810d40c0..f22009ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,9 +125,6 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.1.0) sprockets-rails (~> 2.0) - rails-i18n (4.0.4) - i18n (~> 0.6) - railties (~> 4.0) railties (4.1.0) actionpack (= 4.1.0) activesupport (= 4.1.0) @@ -225,7 +222,6 @@ DEPENDENCIES paperclip (~> 4.2.0) pg rails (= 4.1.0) - rails-i18n (~> 4.0.0) rmagick (= 2.13.4) rubocop sass-rails (~> 4.0.3) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 91597092..6760914e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,5 @@ # Superclass for all model controllers class ApplicationController < ActionController::Base - include Localized protect_from_forgery helper :html diff --git a/app/controllers/concerns/localized.rb b/app/controllers/concerns/localized.rb deleted file mode 100644 index 5c3a20ae..00000000 --- a/app/controllers/concerns/localized.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'active_support/concern' - -# Sets the locale for every request, from the first available value among -# the following: -# 1. a URL parameter called "locale", ex. +?locale=en+ -# 2. the +HTTP_ACCEPT_LANGUAGE+ header property -# 3. the default locale in +I18n.default_locale+ -module Localized - extend ActiveSupport::Concern - - included do - before_action :set_locale - end - - # Sets +I18n.locale+ from the first available value among the following: - # 1. a URL parameter called "locale", ex. +?locale=en+ - # 2. the +HTTP_ACCEPT_LANGUAGE+ header property - # 3. the default locale in +I18n.default_locale+ - def set_locale - I18n.locale = requested_locale || I18n.default_locale - end - - # The locale requested by the user. Returns the first available value: - # 1. a URL paramter called "locale" - # 2. the +HTTP_ACCEPT_LANGUAGE+ header property - def requested_locale - validate_locale locale_from_url_params || - locale_from_accept_language_header - end - - # Returns the given locale if localizations for it are available. - # Returns nil otherwise. - def validate_locale(locale) - return if locale.blank? - locale if locale.to_sym.in?(I18n.available_locales) - end - - # The locale in the URL paramters - def locale_from_url_params - params[:locale] - end - - # The two-character locale in the +HTTP_ACCEPT_LANGUAGE+ header field - def locale_from_accept_language_header - return if request.blank? - return if request.env['HTTP_ACCEPT_LANGUAGE'].blank? - - request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first - end -end diff --git a/app/views/layouts/_login_box.html.erb b/app/views/layouts/_login_box.html.erb index 5c2bbb33..46cefeb0 100644 --- a/app/views/layouts/_login_box.html.erb +++ b/app/views/layouts/_login_box.html.erb @@ -6,22 +6,22 @@ <% else %> -
  • <%= link_to t('.login'), login_path %>
  • -
  • <%= link_to t('.register'), signup_path %>
  • +
  • Login
  • +
  • Register
  • <% end %> diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 1eb8a0a9..31aaf30e 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -1,29 +1,25 @@