captive: Show access page in browser language

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Daniel Weismüller <daniel.weismüller@ipfire.org>
This commit is contained in:
Michael Tremer
2017-05-03 15:39:50 +02:00
parent 1d68e28753
commit 5f1b951102
2 changed files with 18 additions and 0 deletions

View File

@@ -179,4 +179,18 @@ sub FindWebLanguage() {
return undef;
}
sub DetectBrowserLanguages() {
my $langs = $ENV{"HTTP_ACCEPT_LANGUAGE"};
my @results = ();
foreach my $lang (split /[,;]/, $langs) {
# Drop all q= arguments
next if ($lang =~ m/^q=/);
push(@results, $lang);
}
return @results;
}
1;