File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def user_preferred_locale(header)
7575 matched_locale = I18n . available_locales . find { |al | match? ( al , locale ) } if locale
7676 if !locale && !matched_locale
7777 matched_locale = locales . reverse . find { |locale | I18n . available_locales . any? { |al | variant_match? ( al , locale ) } }
78- matched_locale = matched_locale [ 0 , 2 ] if matched_locale
78+ matched_locale = matched_locale [ 0 , 2 ] . downcase if matched_locale
7979 end
8080 matched_locale
8181 else
Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ def enforce_available_locales(enforce)
7575 _ ( response_with_languages ( 'pt;Q=0.9,es-CL' ) . body ) . must_equal ( 'es' )
7676 end
7777
78+ specify 'should match languages with variants case insensitively' do
79+ _ ( response_with_languages ( 'pt;Q=0.9,ES-CL' ) . body ) . must_equal ( 'es' )
80+ end
81+
7882 specify 'should skip * if it is followed by other languages' do
7983 _ ( response_with_languages ( '*,dk;q=0.5' ) . body ) . must_equal ( 'dk' )
8084 end
You can’t perform that action at this time.
0 commit comments