X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=config%2Fcfgroot%2Flang.pl;h=2b09c4a9ff44ab4baf05b3e7439b218c35a28d2b;hb=3ed2de12510dcca5dea8e96b02f785cb0f8fe10c;hp=3b001ad9d433ad2fe354e29369f017294dcd5137;hpb=a895c5cfc4cb81aff7677b42b689bdb0da4d9c5c;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/config/cfgroot/lang.pl b/config/cfgroot/lang.pl index 3b001ad9d4..2b09c4a9ff 100644 --- a/config/cfgroot/lang.pl +++ b/config/cfgroot/lang.pl @@ -169,6 +169,9 @@ sub FindWebLanguage() { my ($language, $country) = split(/_/, $shortlang); push(@options, $language); + # Add English as fallback + push(@options, "en"); + foreach my $option (@options) { return $option if (-e "${General::swroot}/langs/$option.pl"); } @@ -176,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;