From 6b883f050f940bf3f36faba963f6640e973c1500 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 18 Jul 2013 22:37:35 +0800 Subject: [PATCH] Force english only --- app/controllers/application_controller.rb | 27 ++++++++++++----------- app/views/layouts/_orbit_bar.html.erb | 8 ------- config/application.rb | 2 +- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fcb1052a5..b1cc2c641 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -137,19 +137,20 @@ class ApplicationController < ActionController::Base # Set I18n.locale def set_locale - # update session if passed - session[:locale] = params[:locale] if params[:locale] - browser_locale = condition = nil - # check if locale is valid for non site pages - if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) - condition = VALID_LOCALES.include?(session[:locale]) - elsif session[:locale] - condition = @site_in_use_locales.include?(session[:locale]) - else - browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil - condition = @site_in_use_locales.include?(browser_locale) - end - session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s + # # update session if passed + # session[:locale] = params[:locale] if params[:locale] + # browser_locale = condition = nil + # # check if locale is valid for non site pages + # if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) + # condition = VALID_LOCALES.include?(session[:locale]) + # elsif session[:locale] + # condition = @site_in_use_locales.include?(session[:locale]) + # else + # browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil + # condition = @site_in_use_locales.include?(browser_locale) + # end + # session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s + session[:locale] = 'en' I18n.locale = session[:locale].to_sym end diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 52deb8e7e..70db95b8c 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -35,14 +35,6 @@ <%= text_field_tag 'q','',{:class => "search-query span3",:placeholder=> t(:search_google) ,:disabled=> ((@site.search["sitesearch"] || @site.search["domains"] ).blank? rescue true)}%> - <% if user_signed_in? %>