|
1 |
# redMine - project management software
|
|
2 |
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or
|
|
5 |
# modify it under the terms of the GNU General Public License
|
|
6 |
# as published by the Free Software Foundation; either version 2
|
|
7 |
# of the License, or (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17 |
|
|
18 |
require "#{File.dirname(__FILE__)}/../test_helper"
|
|
19 |
|
|
20 |
class ApplicationTest < ActionController::IntegrationTest
|
|
21 |
fixtures :users
|
|
22 |
|
|
23 |
def test_set_localization
|
|
24 |
Setting.default_language = 'en'
|
|
25 |
|
|
26 |
# a french user
|
|
27 |
get 'projects', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
|
|
28 |
assert_response :success
|
|
29 |
assert_tag :tag => 'h2', :content => 'Projets'
|
|
30 |
assert_equal 'fr', User.current.language
|
|
31 |
|
|
32 |
# then an italien user
|
|
33 |
get 'projects', { }, 'Accept-Language' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
|
|
34 |
assert_response :success
|
|
35 |
assert_tag :tag => 'h2', :content => 'Progetti'
|
|
36 |
assert_equal 'it', User.current.language
|
|
37 |
|
|
38 |
# not a supported language: default language should be used
|
|
39 |
get 'projects', { }, 'Accept-Language' => 'zz'
|
|
40 |
assert_response :success
|
|
41 |
assert_tag :tag => 'h2', :content => 'Projects'
|
|
42 |
end
|
|
43 |
end
|
0 |
44 |
|
Fixed a bug in localization introduced by r1131 (anonymous users inherit the language of the first anonymous user).