forked from saurabh/orbit4-5
language switch for orbit bar can be enabled or disabled from backend.
This commit is contained in:
parent
94f1de8de9
commit
4068d8488a
|
@ -25,6 +25,7 @@ class Site
|
||||||
field :enable_language_detection, :type => Boolean, :default => false
|
field :enable_language_detection, :type => Boolean, :default => false
|
||||||
field :enable_redirect_index, :type => Boolean, :default => false
|
field :enable_redirect_index, :type => Boolean, :default => false
|
||||||
field :enable_zh_cn, :type => Boolean, :default => true
|
field :enable_zh_cn, :type => Boolean, :default => true
|
||||||
|
field :enable_language_options, :type => Boolean, :default => true
|
||||||
field :default_locale, :default => "zh_tw"
|
field :default_locale, :default => "zh_tw"
|
||||||
field :mobile_on, :type => Boolean, :default => false
|
field :mobile_on, :type => Boolean, :default => false
|
||||||
field :announcement_category, :type => Array, :default=>[]
|
field :announcement_category, :type => Array, :default=>[]
|
||||||
|
|
|
@ -193,6 +193,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('preferences.enable_language_options') %>
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.check_box :enable_language_options, :class => "toggle-check", data: {disabled: true} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- OrbitBar Them -->
|
<!-- OrbitBar Them -->
|
||||||
|
|
|
@ -116,30 +116,34 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li>
|
<li>
|
||||||
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
|
<% if current_site.enable_language_options %>
|
||||||
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
|
<% if @site_in_use_locales.count > 1 || current_site.enable_zh_cn %>
|
||||||
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
|
<% zh_cn_added = 0 %>
|
||||||
<ul>
|
<% locale = session[:zh_cn] ? :zh_cn : I18n.locale %>
|
||||||
<% @site_in_use_locales.each do |l| %>
|
<span id="language"><i class="icons-earth orbit-bar-language-icon"></i><span class="orbit-bar-language-text">Language</span></span>
|
||||||
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
|
<ul>
|
||||||
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
<% @site_in_use_locales.each do |l| %>
|
||||||
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
|
<% if l.to_s == I18n.locale.to_s and !session['zh_cn'] %>
|
||||||
</li>
|
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
||||||
<% else %>
|
<%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %>
|
||||||
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
|
||||||
<a href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% if current_site.enable_zh_cn and l == :zh_tw and !request.path.include?("/admin/") %>
|
|
||||||
<% if locale == :zh_cn %>
|
|
||||||
<li class="active">
|
|
||||||
<%= t(:zh_cn, :locale => :zh_tw) %>
|
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li>
|
<li class="<%= (l == I18n.locale and !session['zh_cn']) ? "active" : "" %>">
|
||||||
<a href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
|
<a href="<%= switch_language(l) %>"><%= t((l==:zh_tw ? :zh_tw_ : :_locale ), :locale => l) %></a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if current_site.enable_zh_cn and zh_cn_added == 0 and !request.path.include?("/admin/") %>
|
||||||
|
<% zh_cn_added = 1 %>
|
||||||
|
<% if locale == :zh_cn %>
|
||||||
|
<li class="active">
|
||||||
|
<%= t(:zh_cn, :locale => :zh_tw) %>
|
||||||
|
</li>
|
||||||
|
<% else %>
|
||||||
|
<li>
|
||||||
|
<a href="<%= switch_language(:zh_cn) %>"><%= t(:zh_cn, :locale => :zh_tw) %></a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -412,6 +412,7 @@ en:
|
||||||
preferences:
|
preferences:
|
||||||
backend_open: All users can visit backend pages
|
backend_open: All users can visit backend pages
|
||||||
change: Change
|
change: Change
|
||||||
|
enable_language_options: Enable language option on OrbitBar
|
||||||
classification: Classification
|
classification: Classification
|
||||||
frontend_open: "If Checked, the frontend will be open for all users."
|
frontend_open: "If Checked, the frontend will be open for all users."
|
||||||
favicon: Favicon
|
favicon: Favicon
|
||||||
|
|
|
@ -422,6 +422,7 @@ zh_tw:
|
||||||
preference: 系統偏好
|
preference: 系統偏好
|
||||||
preferences:
|
preferences:
|
||||||
backend_open: 開啟後台給所有使用者
|
backend_open: 開啟後台給所有使用者
|
||||||
|
enable_language_options: 在OrbitBar上打開語系選擇
|
||||||
change: 更改
|
change: 更改
|
||||||
classification: 類別
|
classification: 類別
|
||||||
enable_zh_cn: 開啟簡體中文
|
enable_zh_cn: 開啟簡體中文
|
||||||
|
|
Loading…
Reference in New Issue