aboutsummaryrefslogtreecommitdiffstats
path: root/t/i18n.t
diff options
context:
space:
mode:
Diffstat (limited to 't/i18n.t')
-rw-r--r--t/i18n.t11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/i18n.t b/t/i18n.t
index 4179dd8d0..f1cc86985 100644
--- a/t/i18n.t
+++ b/t/i18n.t
@@ -7,6 +7,7 @@ use FixMyStreet;
use mySociety::Locale;
use Encode;
use Data::Dumper;
+use HTTP::Headers;
use Sort::Key qw(keysort);
use POSIX 'strcoll';
local $Data::Dumper::Sortkeys = 1;
@@ -18,6 +19,16 @@ die "You need to run 'commonlib/bin/gettext-makemo --quiet FixMyStreet' "
unless -e FixMyStreet->path_to(
'locale/cy_GB.UTF-8/LC_MESSAGES/FixMyStreet-EmptyHomes.mo');
+# Test the language negotiation works
+my $lang = mySociety::Locale::negotiate_language(
+ 'en-gb,English,en_GB|cy,Cymraeg,cy_GB|es,Spanish,es_ES',
+ undef,
+ HTTP::Headers->new(
+ Accept_Language => 'es,en-gb;q=0.6,en;q=0.4'
+ )
+);
+is $lang, 'es', 'Language negotiation works okay';
+
# Example strings
my $english = "Please enter a valid email";
my $welsh = "Cofnodwch gyfeiriad e-bost dilys";