set html lang by user locale (#14206)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11952 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2013-06-10 01:41:30 +00:00
parent 5a7f656303
commit ebb73fa258
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="<%= current_language %>">
<head>
<meta charset="utf-8" />
<title><%=h html_title %></title>

View File

@ -36,17 +36,20 @@ class ApplicationTest < ActionController::IntegrationTest
assert_response :success
assert_tag :tag => 'h2', :content => 'Projets'
assert_equal :fr, current_language
assert_select "html[lang=?]", "fr"
# then an italien user
get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
assert_response :success
assert_tag :tag => 'h2', :content => 'Progetti'
assert_equal :it, current_language
assert_select "html[lang=?]", "it"
# not a supported language: default language should be used
get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
assert_response :success
assert_tag :tag => 'h2', :content => 'Projects'
assert_select "html[lang=?]", "en"
end
def test_token_based_access_should_not_start_session