Commit 2dc9d7c4 authored by o@immerda.ch's avatar o@immerda.ch
Browse files

fix horde login lang selection

parent 3712591c
......@@ -31,7 +31,12 @@ class ApplicationController < ActionController::Base
end
def set_locale
I18n.locale = valid_l(params[:l]) || valid_l(session[:locale]) || extract_locale || I18n.default_locale
I18n.locale =
valid_l(params[:horde_lang]) ||
valid_l(params[:l]) ||
valid_l(session[:locale]) ||
extract_locale ||
I18n.default_locale
session[:locale] = I18n.locale
end
......
......@@ -250,6 +250,7 @@ class SessionsController < ApplicationController
else
@horde_select_view = params[:horde_select_view]
end
@horde_lang = params[:horde_lang]
unless load_page.present?
@news_frame = news_frame
end
......
<div id='handoff-page-marker'> </div>
<% horde_lang_map = {
de: 'de_DE',
en: 'en_US',
it: 'it_IT',
es: 'es_ES',
fr: 'fr_FR',
} %>
<%= t(:logging_into, target: t("handoff.#{@handoff}")) %>
<% if @handoff == 'webmail' || @handoff == 'webmail-dev' %>
<div style="display:none">
......@@ -18,7 +11,7 @@
<%= hidden_field('', :app) %>
<%= hidden_field('', :url) %>
<%= hidden_field('', :anchor_string) %>
<%= hidden_field('', :new_lang, value: horde_lang_map[session[:locale]]) %>
<%= hidden_field('', :new_lang, value: @webmail_lang) %>
<%= hidden_field('', :users_handoff, :value => horde_handoff_auth) %>
<%= submit_tag (t :submit) %>
<% end %>
......
......@@ -13,13 +13,18 @@
<br/>
<noscript><%= t(:requires_javascript) %><br/><br/></noscript>
<% full_lang = {
de: 'Deutsch',
en: 'English',
es: 'Español',
fr: 'Français',
it: 'Italiano',
} %>
<%
webmail_locales = [
['Deutsch', 'de_CH'],
['English', 'en_US'],
['Español', 'es_ES'],
['Français', 'fr_FR'],
['Italiano', 'it_IT']
]
webmail_locales_map = {
de: 'de_CH', en: 'en_US', es: 'es_ES', fr: 'fr_FR', it: 'it_IT',
}
%>
<%= form_tag(request.path, method: 'post', target: '_self') do %>
<p>
......@@ -33,10 +38,11 @@
</td><td>
<%= password_field_tag(:password) %>
</td></tr>
<tr><td></td><td>
<%= select('', 'l', I18n.available_locales.map{|l| [full_lang[l], l]}, selected: session[:locale]) %>
</td></tr>
<%- if @handoff == 'webmail' %>
<%- if @handoff =~ /webmail/ %>
<tr><td></td><td>
<%= select('', 'horde_lang', webmail_locales,
selected: @horde_lang || webmail_locales_map[session[:locale]]) %>
</td></tr>
<tr><td></td><td>
<div id="mobile_view_div">
<input style="margin:2px 0 5px 0;" type="checkbox" id="mobile_view" name="mobile_view" <%= if @horde_select_view == 'smartmobile' then 'checked="checked"' else '' end %> /> <%= t(:mobile_view) %>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment