summaryrefslogtreecommitdiff
path: root/modules/gallery/tests
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-09-15 11:19:32 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-09-15 11:19:32 -0700
commit59eadacc67acb10d803ca7ef1bdc0635041a1d41 (patch)
tree64f9f9e98bf19e8b9d3b94a74a3e0c69523f4926 /modules/gallery/tests
parent5f343ab8a0538d68b905e86968cfd80902512d8a (diff)
Improve language preference (Acccept-Language header matching): Boost same-language match over exact locale match for lower qvalue.
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r--modules/gallery/tests/Locales_Helper_Test.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/tests/Locales_Helper_Test.php b/modules/gallery/tests/Locales_Helper_Test.php
index 85b8e206..4c03d8d4 100644
--- a/modules/gallery/tests/Locales_Helper_Test.php
+++ b/modules/gallery/tests/Locales_Helper_Test.php
@@ -67,7 +67,7 @@ class Locales_Helper_Test extends Unit_Test_Case {
locales::update_installed(array("no_NO", "pt_PT", "ja_JP"));
$_SERVER["HTTP_ACCEPT_LANGUAGE"] = "en,en-us,ja_JP;q=0.7,no-fr;q=0.9";
$locale = locales::locale_from_http_request();
- $this->assert_equal("ja_JP", $locale);
+ $this->assert_equal("no_NO", $locale);
}
public function locale_from_http_request_best_match_vs_installed_2_test() {
@@ -83,4 +83,12 @@ class Locales_Helper_Test extends Unit_Test_Case {
$locale = locales::locale_from_http_request();
$this->assert_equal(null, $locale);
}
+
+ public function locale_from_http_request_prefer_inexact_same_language_match_over_exact_other_language_match_test() {
+ locales::update_installed(array("de_DE", "ar_AR", "fa_IR", "he_IL", "en_US"));
+ // Accept-Language header from Firefox 3.5/Ubuntu
+ $_SERVER["HTTP_ACCEPT_LANGUAGE"] = "he,en-us;q=0.9,de-ch;q=0.5,en;q=0.3";
+ $locale = locales::locale_from_http_request();
+ $this->assert_equal("he_IL", $locale);
+ }
} \ No newline at end of file