##// END OF EJS Templates
set html lang by user locale (#14206)...
Toshi MARUYAMA -
r11722:ebb73fa258db
parent child
Show More
@@ -1,5 +1,5
1 <!DOCTYPE html>
1 <!DOCTYPE html>
2 <html lang="en">
2 <html lang="<%= current_language %>">
3 <head>
3 <head>
4 <meta charset="utf-8" />
4 <meta charset="utf-8" />
5 <title><%=h html_title %></title>
5 <title><%=h html_title %></title>
@@ -36,17 +36,20 class ApplicationTest < ActionController::IntegrationTest
36 assert_response :success
36 assert_response :success
37 assert_tag :tag => 'h2', :content => 'Projets'
37 assert_tag :tag => 'h2', :content => 'Projets'
38 assert_equal :fr, current_language
38 assert_equal :fr, current_language
39 assert_select "html[lang=?]", "fr"
39
40
40 # then an italien user
41 # then an italien user
41 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
42 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
42 assert_response :success
43 assert_response :success
43 assert_tag :tag => 'h2', :content => 'Progetti'
44 assert_tag :tag => 'h2', :content => 'Progetti'
44 assert_equal :it, current_language
45 assert_equal :it, current_language
46 assert_select "html[lang=?]", "it"
45
47
46 # not a supported language: default language should be used
48 # not a supported language: default language should be used
47 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
49 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
48 assert_response :success
50 assert_response :success
49 assert_tag :tag => 'h2', :content => 'Projects'
51 assert_tag :tag => 'h2', :content => 'Projects'
52 assert_select "html[lang=?]", "en"
50 end
53 end
51
54
52 def test_token_based_access_should_not_start_session
55 def test_token_based_access_should_not_start_session
General Comments 0
You need to be logged in to leave comments. Login now