summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Config/Common.pm8
-rw-r--r--Bugzilla/Install/Util.pm2
-rw-r--r--Bugzilla/Template.pm2
3 files changed, 9 insertions, 3 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 14406019d..8435b20a1 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -305,17 +305,23 @@ sub check_image_converter {
}
sub check_languages {
- my @languages = split /[,\s]+/, trim($_[0]);
+ my ($lang) = @_;
+ my @languages = split(/[,\s]+/, trim($lang));
if(!scalar(@languages)) {
return "You need to specify a language tag."
}
my $templatedir = bz_locations()->{'templatedir'};
+ my %lang_seen;
+ my @validated_languages;
foreach my $language (@languages) {
if( ! -d "$templatedir/$language/custom"
&& ! -d "$templatedir/$language/default") {
return "The template directory for $language does not exist";
}
+ push(@validated_languages, $language) unless $lang_seen{$language}++;
}
+ # Rebuild the list of language tags, avoiding duplicates.
+ $_[0] = join(', ', @validated_languages);
return "";
}
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm
index 931d9f1b5..9bab77a8a 100644
--- a/Bugzilla/Install/Util.pm
+++ b/Bugzilla/Install/Util.pm
@@ -127,7 +127,7 @@ sub template_include_path {
my @supported;
if (defined $params->{use_languages}) {
- @supported = $params->{use_languages};
+ @supported = @{$params->{use_languages}};
}
else {
my @dirs = glob(bz_locations()->{'templatedir'} . "/*");
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index ece959778..20fe83112 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -87,7 +87,7 @@ sub getTemplateIncludePath {
my $cache = Bugzilla->request_cache;
my $lang = $cache->{'language'} || "";
$cache->{"template_include_path_$lang"} ||= template_include_path({
- use_languages => trim(Bugzilla->params->{'languages'}),
+ use_languages => [split(/[\s,]+/, Bugzilla->params->{'languages'})],
only_language => $lang });
return $cache->{"template_include_path_$lang"};
}