diff --git a/core/app/views/shared/_site_bar.html.erb b/core/app/views/shared/_site_bar.html.erb index 9091707ae2..dc81d0bd27 100644 --- a/core/app/views/shared/_site_bar.html.erb +++ b/core/app/views/shared/_site_bar.html.erb @@ -18,7 +18,7 @@ <%= RefinerySetting.find_or_set(:site_name, 'Company Name') %> - <%= link_to t('.log_out', :locale => (defined?(::Refinery::I18n) ? ::Refinery::I18n.current_locale : :en)), + <%= link_to t('.log_out', site_bar_translate_locale_args), destroy_user_session_path, :id => 'logout' %> diff --git a/core/lib/refinery/helpers/site_bar_helper.rb b/core/lib/refinery/helpers/site_bar_helper.rb index b76a21afa4..078f26d563 100644 --- a/core/lib/refinery/helpers/site_bar_helper.rb +++ b/core/lib/refinery/helpers/site_bar_helper.rb @@ -4,13 +4,13 @@ module SiteBarHelper # Generates the link to determine where the site bar switch button returns to. def site_bar_switch_link - link_to_if(admin?, t('.switch_to_your_website', :locale => (defined?(::Refinery::I18n) ? ::Refinery::I18n.current_locale : :en), + link_to_if(admin?, t('.switch_to_your_website', site_bar_translate_locale_args), (if session.keys.include?(:website_return_to) and session[:website_return_to].present? session[:website_return_to] else root_path(:locale => (::Refinery::I18n.default_frontend_locale if defined?(::Refinery::I18n) && ::Refinery::I18n.enabled?)) end)) do - link_to t('.switch_to_your_website_editor', :locale => (defined?(::Refinery::I18n) ? ::Refinery::I18n.current_locale : :en)), + link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args), (if session.keys.include?(:refinery_return_to) and session[:refinery_return_to].present? session[:refinery_return_to] else @@ -19,6 +19,14 @@ def site_bar_switch_link end end + def site_bar_translate_locale_args + if defined?(::Refinery::I18n) + {:locale => ::Refinery::I18n.current_locale} + else + {} + end + end + end end end