summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-05-12 15:33:49 +0000
committerlpsolit%gmail.com <>2008-05-12 15:33:49 +0000
commit1d34c237764ec4374315b3b619b7b93b21153f73 (patch)
tree526dfe1d8a0ef7533486b782484a97ea8896da1b /Bugzilla/Template
parentBug 432726: [Oracle] DROP INDEX doesn't hash the index name (diff)
downloadbugzilla-1d34c237764ec4374315b3b619b7b93b21153f73.tar.gz
bugzilla-1d34c237764ec4374315b3b619b7b93b21153f73.tar.bz2
bugzilla-1d34c237764ec4374315b3b619b7b93b21153f73.zip
Bug 433282: Template hooks do not work if HTTP_ACCEPT_LANGUAGE doesn't match any language available - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla/Template')
-rw-r--r--Bugzilla/Template/Plugin/Hook.pm25
1 files changed, 2 insertions, 23 deletions
diff --git a/Bugzilla/Template/Plugin/Hook.pm b/Bugzilla/Template/Plugin/Hook.pm
index 54ce02a67..4e3bf5cef 100644
--- a/Bugzilla/Template/Plugin/Hook.pm
+++ b/Bugzilla/Template/Plugin/Hook.pm
@@ -26,7 +26,7 @@ package Bugzilla::Template::Plugin::Hook;
use strict;
use Bugzilla::Constants;
-use Bugzilla::Install::Util;
+use Bugzilla::Install::Util qw(include_languages);
use Bugzilla::Template;
use Bugzilla::Util;
use Bugzilla::Error;
@@ -66,7 +66,7 @@ sub process {
# munge the filename to create the extension hook filename:
my $extensiontemplate = $subpath.'/'.$templatename.'-'.$hook_name.'.'.$type.'.tmpl';
my @extensions = glob(bz_locations()->{'extensionsdir'} . "/*");
- my @usedlanguages = getLanguages();
+ my @usedlanguages = include_languages({use_languages => Bugzilla->languages});
foreach my $extension (@extensions) {
foreach my $language (@usedlanguages) {
my $file = $extension.'/template/'.$language.'/'.$extensiontemplate;
@@ -104,27 +104,6 @@ sub process {
return $output;
}
-# get a list of languages we accept so we can find the hook
-# that corresponds to our desired languages:
-sub getLanguages() {
- my $languages = join(',', @{Bugzilla->languages});
- if (not ($languages =~ /,/)) { # only one language
- return $languages;
- }
- # XXX This should probably be re-worked so that we don't have to
- # reach into the internals of another module to get languages.
- my @languages = Bugzilla::Install::Util::_sort_accept_language($languages);
- my @accept_language = Bugzilla::Install::Util::_sort_accept_language(
- $ENV{'HTTP_ACCEPT_LANGUAGE'} || "" );
- my @usedlanguages;
- foreach my $lang (@accept_language) {
- if(my @found = grep /^\Q$lang\E(-.+)?$/i, @languages) {
- push (@usedlanguages, @found);
- }
- }
- return @usedlanguages;
-}
-
1;
__END__