Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item13328: Error a language if the name is missing
Otherwise the language file is silently omitted when the Languages cache
is loaded.
  • Loading branch information
gac410 committed Mar 27, 2015
1 parent e97de49 commit 1fcce5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/lib/Foswiki/Configure/Checkers/LANGUAGE.pm
Expand Up @@ -5,6 +5,7 @@ use strict;
use warnings;

use Assert;
use Foswiki::I18N;

require Foswiki::Configure::Checker;
our @ISA = ('Foswiki::Configure::Checker');
Expand All @@ -29,7 +30,6 @@ sub check_current_value {

my $dir = $Foswiki::cfg{LocalesDir};
Foswiki::Configure::Load::expandValue($dir);
my $compress = $Foswiki::cfg{LanguageFileCompression};

my $lang = $this->{item}->{keys};
unless ( $lang =~ s/^\{Languages\}\{'?([\w-]+)'?\}\{Enabled\}$/$1/ ) {
Expand All @@ -39,6 +39,14 @@ sub check_current_value {
return $reporter->ERROR("Missing language file $dir/$lang.po")
unless ( -r "$dir/$lang.po" );

# Code taken from Foswki::I18N
my $h = Foswiki::I18N->get_handle($lang);
my $name = eval { $h->maketext("_language_name") };
unless ($name) {
$reporter->ERROR(
"Internal error: $lang is missing the '_language_name' from it's translation. Language will not be usable."
);
}
}

=begin TML
Expand Down

0 comments on commit 1fcce5a

Please sign in to comment.