From d18a57e6c9995169dd0f93e70c63f847712a3e6f Mon Sep 17 00:00:00 2001 From: uu59 Date: Wed, 28 May 2014 14:47:14 +0900 Subject: [PATCH] Add language switching menu into global nav --- app/helpers/application_helper.rb | 10 ++++++++++ app/views/layouts/application.html.erb | 12 ++++++++++++ config/locales/translation_en.yml | 1 + config/locales/translation_ja.yml | 1 + 4 files changed, 24 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3946cba..c325c38 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# coding: utf-8 + module ApplicationHelper def need_restart? Plugin.gemfile_changed? @@ -35,6 +37,14 @@ module ApplicationHelper %Q|
  • #{icon icon_class} #{text}
  • |.html_safe 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) 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. diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9cfd0b8..05b3756 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -37,6 +37,18 @@