Force english only
This commit is contained in:
parent
09bb318d6a
commit
6b883f050f
|
@ -137,19 +137,20 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
# Set I18n.locale
|
# Set I18n.locale
|
||||||
def set_locale
|
def set_locale
|
||||||
# update session if passed
|
# # update session if passed
|
||||||
session[:locale] = params[:locale] if params[:locale]
|
# session[:locale] = params[:locale] if params[:locale]
|
||||||
browser_locale = condition = nil
|
# browser_locale = condition = nil
|
||||||
# check if locale is valid for non site pages
|
# # check if locale is valid for non site pages
|
||||||
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
|
# if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
|
||||||
condition = VALID_LOCALES.include?(session[:locale])
|
# condition = VALID_LOCALES.include?(session[:locale])
|
||||||
elsif session[:locale]
|
# elsif session[:locale]
|
||||||
condition = @site_in_use_locales.include?(session[:locale])
|
# condition = @site_in_use_locales.include?(session[:locale])
|
||||||
else
|
# else
|
||||||
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
# browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
||||||
condition = @site_in_use_locales.include?(browser_locale)
|
# condition = @site_in_use_locales.include?(browser_locale)
|
||||||
end
|
# end
|
||||||
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
# session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
||||||
|
session[:locale] = 'en'
|
||||||
I18n.locale = session[:locale].to_sym
|
I18n.locale = session[:locale].to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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)}%>
|
<%= text_field_tag 'q','',{:class => "search-query span3",:placeholder=> t(:search_google) ,:disabled=> ((@site.search["sitesearch"] || @site.search["domains"] ).blank? rescue true)}%>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown language">
|
|
||||||
<a class="dropdown-toggle orbit-bar-language" href="#" data-toggle="dropdown" data-icons=""></a>
|
|
||||||
<ul class="dropdown-menu language-menu">
|
|
||||||
<% @site_in_use_locales.compact.each do |locale| %>
|
|
||||||
<%= content_tag :li, (link_to t(:_locale, :locale => locale), add_locale(remove_locale((referer rescue request.fullpath)), locale)), :class => (I18n.locale.eql?(locale.to_sym) ? 'active' : nil) %>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li class="dropdown active">
|
<li class="dropdown active">
|
||||||
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
|
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
|
||||||
|
|
|
@ -54,7 +54,7 @@ module Orbit
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
config.i18n.load_path += Dir[Rails.root.join('vendor', 'built_in_modules', '*', 'config', 'locales', '*.{rb,yml}').to_s]
|
config.i18n.load_path += Dir[Rails.root.join('vendor', 'built_in_modules', '*', 'config', 'locales', '*.{rb,yml}').to_s]
|
||||||
config.i18n.default_locale = :zh_tw
|
config.i18n.default_locale = :en
|
||||||
|
|
||||||
# JavaScript files you want as :defaults (application.js is always included).
|
# JavaScript files you want as :defaults (application.js is always included).
|
||||||
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
||||||
|
|
Loading…
Reference in New Issue