summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Config/Common.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Config/Common.pm')
-rw-r--r--Bugzilla/Config/Common.pm8
1 files changed, 7 insertions, 1 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 "";
}