From: Mark Wells Date: Thu, 30 Jan 2014 02:34:27 +0000 (-0800) Subject: fix localization cache, #27276 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=bcf19c4221daf8fbc245789408fb09528005e876;p=freeside.git fix localization cache, #27276 --- diff --git a/FS/FS/L10N/DBI.pm b/FS/FS/L10N/DBI.pm index db387dba6..dc9231785 100644 --- a/FS/FS/L10N/DBI.pm +++ b/FS/FS/L10N/DBI.pm @@ -3,15 +3,22 @@ use base qw(FS::L10N); use strict; use FS::Msgcat; -our %Lexicon = (); +sub lexicon { + my $lh = shift; + my $class = ref($lh) || $lh; + no strict 'refs'; + \%{ $class . '::Lexicon' }; +} sub maketext { my($lh, $key, @rest) = @_; - unless ( exists $Lexicon{$key} ) { - my $lang = $lh->language_tag; - $lang =~ s/-(\w*)/_\U$1/; - $Lexicon{$key} = FS::Msgcat::_gettext( $key, $lang ); + my $lang = $lh->language_tag; + $lang =~ s/-(\w*)/_\U$1/; + + my $lex = $lh->lexicon; + unless ( exists $lex->{$key} ) { + $lex->{$key} = FS::Msgcat::_gettext( $key, $lang ); } my $res = eval { $lh->SUPER::maketext($key, @rest) };