speed up i18n calls

This commit is contained in:
Graham Knop 2008-11-24 04:00:55 +00:00
parent d9c1f88eab
commit a922eca6bb

View file

@ -97,6 +97,11 @@ sub get {
$language =~ s/$safeRe//g; $language =~ s/$safeRe//g;
$namespace =~ s/$safeRe//g; $namespace =~ s/$safeRe//g;
my $cmd = "WebGUI::i18n::".$language."::".$namespace; my $cmd = "WebGUI::i18n::".$language."::".$namespace;
my $table = do {
no strict 'refs';
${"$cmd\::I18N"};
};
if (! $table) {
eval { WebGUI::Pluggable::load($cmd); }; eval { WebGUI::Pluggable::load($cmd); };
if ($@) { if ($@) {
if ($language eq 'English') { if ($language eq 'English') {
@ -108,10 +113,9 @@ sub get {
return $output; return $output;
} }
} }
my $table = do {
no strict 'refs'; no strict 'refs';
${"$cmd\::I18N"}; $table = ${"$cmd\::I18N"};
}; }
my $output = $table->{$id}->{message}; my $output = $table->{$id}->{message};
$output = $self->get($id, $namespace, "English") $output = $self->get($id, $namespace, "English")
if ($output eq "" && $language ne "English"); if ($output eq "" && $language ne "English");