mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 01:07:09 +02:00
Add language switching menu into global nav
This commit is contained in:
parent
9f5c100b0d
commit
d18a57e6c9
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def need_restart?
|
def need_restart?
|
||||||
Plugin.gemfile_changed?
|
Plugin.gemfile_changed?
|
||||||
@ -35,6 +37,14 @@ module ApplicationHelper
|
|||||||
%Q|<li><a><div>#{icon icon_class} <span>#{text}</span></div></a></li>|.html_safe
|
%Q|<li><a><div>#{icon icon_class} <span>#{text}</span></div></a></li>|.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def language_name(locale)
|
||||||
|
# NOTE: these are fixed terms, not i18n-ed
|
||||||
|
{
|
||||||
|
en: "English",
|
||||||
|
ja: "日本語",
|
||||||
|
}[locale] || locale
|
||||||
|
end
|
||||||
|
|
||||||
def link_to_other(text, path)
|
def link_to_other(text, path)
|
||||||
if current_page?(path)
|
if current_page?(path)
|
||||||
# NOTE: sb-admin set style for element name instead of class name, such as ".nav a". So use "a" element even if it isn't a link.
|
# NOTE: sb-admin set style for element name instead of class name, such as ".nav a". So use "a" element even if it isn't a link.
|
||||||
|
@ -37,6 +37,18 @@
|
|||||||
<!-- /.navbar-header -->
|
<!-- /.navbar-header -->
|
||||||
|
|
||||||
<ul class="nav navbar-top-links navbar-right">
|
<ul class="nav navbar-top-links navbar-right">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle " data-toggle="dropdown" href="#">
|
||||||
|
<%= t("terms.switch_language") %>
|
||||||
|
<%= icon("fa-caret-down") %>
|
||||||
|
</a>
|
||||||
|
<ul class="nav dropdown-menu dropdown-alerts">
|
||||||
|
<% I18n.available_locales.each do |locale| %>
|
||||||
|
<li><a href="?lang=<%= locale %>"><%= language_name locale %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<!-- /.dropdown-alerts -->
|
||||||
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle <%= "btn-info" if has_alert? %>" data-toggle="dropdown" href="#">
|
<a class="dropdown-toggle <%= "btn-info" if has_alert? %>" data-toggle="dropdown" href="#">
|
||||||
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
|
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
|
||||||
|
@ -24,6 +24,7 @@ en:
|
|||||||
new: New
|
new: New
|
||||||
setup: "Setup %{target}"
|
setup: "Setup %{target}"
|
||||||
install_it: "Install %{target}"
|
install_it: "Install %{target}"
|
||||||
|
switch_language: Switch Language
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
common: &plugin_common
|
common: &plugin_common
|
||||||
|
@ -24,6 +24,7 @@ ja:
|
|||||||
new: 新規作成
|
new: 新規作成
|
||||||
setup: "%{target}をセットアップ"
|
setup: "%{target}をセットアップ"
|
||||||
install_it: "%{target}をインストール"
|
install_it: "%{target}をインストール"
|
||||||
|
switch_language: 言語切り替え
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
common: &plugin_common
|
common: &plugin_common
|
||||||
|
Loading…
Reference in New Issue
Block a user