##// END OF EJS Templates
set html lang by user locale (#14206)...
Toshi MARUYAMA -
r11722:ebb73fa258db
parent child
Show More
@@ -1,80 +1,80
1 1 <!DOCTYPE html>
2 <html lang="en">
2 <html lang="<%= current_language %>">
3 3 <head>
4 4 <meta charset="utf-8" />
5 5 <title><%=h html_title %></title>
6 6 <meta name="description" content="<%= Redmine::Info.app_name %>" />
7 7 <meta name="keywords" content="issue,bug,tracker" />
8 8 <%= csrf_meta_tag %>
9 9 <%= favicon %>
10 10 <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
11 11 <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
12 12 <%= javascript_heads %>
13 13 <%= heads_for_theme %>
14 14 <%= call_hook :view_layouts_base_html_head %>
15 15 <!-- page specific tags -->
16 16 <%= yield :header_tags -%>
17 17 </head>
18 18 <body class="<%=h body_css_classes %>">
19 19 <div id="wrapper">
20 20 <div id="wrapper2">
21 21 <div id="wrapper3">
22 22 <div id="top-menu">
23 23 <div id="account">
24 24 <%= render_menu :account_menu -%>
25 25 </div>
26 26 <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %>
27 27 <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
28 28 </div>
29 29
30 30 <div id="header">
31 31 <% if User.current.logged? || !Setting.login_required? %>
32 32 <div id="quick-search">
33 33 <%= form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %>
34 34 <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
35 35 <label for='q'>
36 36 <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
37 37 </label>
38 38 <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
39 39 <% end %>
40 40 <%= render_project_jump_box %>
41 41 </div>
42 42 <% end %>
43 43
44 44 <h1><%= page_header_title %></h1>
45 45
46 46 <% if display_main_menu?(@project) %>
47 47 <div id="main-menu">
48 48 <%= render_main_menu(@project) %>
49 49 </div>
50 50 <% end %>
51 51 </div>
52 52
53 53 <div id="main" class="<%= sidebar_content? ? '' : 'nosidebar' %>">
54 54 <div id="sidebar">
55 55 <%= yield :sidebar %>
56 56 <%= view_layouts_base_sidebar_hook_response %>
57 57 </div>
58 58
59 59 <div id="content">
60 60 <%= render_flash_messages %>
61 61 <%= yield %>
62 62 <%= call_hook :view_layouts_base_content %>
63 63 <div style="clear:both;"></div>
64 64 </div>
65 65 </div>
66 66 </div>
67 67
68 68 <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
69 69 <div id="ajax-modal" style="display:none;"></div>
70 70
71 71 <div id="footer">
72 72 <div class="bgl"><div class="bgr">
73 73 Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> &copy; 2006-2013 Jean-Philippe Lang
74 74 </div></div>
75 75 </div>
76 76 </div>
77 77 </div>
78 78 <%= call_hook :view_layouts_base_body_bottom %>
79 79 </body>
80 80 </html>
@@ -1,67 +1,70
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class ApplicationTest < ActionController::IntegrationTest
21 21 include Redmine::I18n
22 22
23 23 fixtures :projects, :trackers, :issue_statuses, :issues,
24 24 :enumerations, :users, :issue_categories,
25 25 :projects_trackers,
26 26 :roles,
27 27 :member_roles,
28 28 :members,
29 29 :enabled_modules
30 30
31 31 def test_set_localization
32 32 Setting.default_language = 'en'
33 33
34 34 # a french user
35 35 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
36 36 assert_response :success
37 37 assert_tag :tag => 'h2', :content => 'Projets'
38 38 assert_equal :fr, current_language
39 assert_select "html[lang=?]", "fr"
39 40
40 41 # then an italien user
41 42 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
42 43 assert_response :success
43 44 assert_tag :tag => 'h2', :content => 'Progetti'
44 45 assert_equal :it, current_language
46 assert_select "html[lang=?]", "it"
45 47
46 48 # not a supported language: default language should be used
47 49 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
48 50 assert_response :success
49 51 assert_tag :tag => 'h2', :content => 'Projects'
52 assert_select "html[lang=?]", "en"
50 53 end
51 54
52 55 def test_token_based_access_should_not_start_session
53 56 # issue of a private project
54 57 get 'issues/4.atom'
55 58 assert_response 302
56 59
57 60 rss_key = User.find(2).rss_key
58 61 get "issues/4.atom?key=#{rss_key}"
59 62 assert_response 200
60 63 assert_nil session[:user_id]
61 64 end
62 65
63 66 def test_missing_template_should_respond_with_404
64 67 get '/login.png'
65 68 assert_response 404
66 69 end
67 70 end
General Comments 0
You need to be logged in to leave comments. Login now