diff options
author | Mark Wells <mark@freeside.biz> | 2014-01-29 18:34:27 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-01-30 12:48:50 -0800 |
commit | 82380ef8cb6e506f63dd4a8d1abf89cb079ae6cc (patch) | |
tree | dc7acc36fe38cd630b7ecabb47362472e14ac92b /FS/FS | |
parent | 4e082c20bcb6754f6f832cfc95d45198a2b920f5 (diff) |
fix localization cache, #27276
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/L10N/DBI.pm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/FS/FS/L10N/DBI.pm b/FS/FS/L10N/DBI.pm index db387db..dc92317 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) }; |