diff options
author | Mark Wells <mark@freeside.biz> | 2014-01-29 18:34:27 -0800 |
---|---|---|
committer | Jeremy Davis <jeremyd@freeside.biz> | 2014-02-07 13:50:06 -0500 |
commit | bcf19c4221daf8fbc245789408fb09528005e876 (patch) | |
tree | 436fac1a7af0d881e1f13d704eaadbc5d00d5dde | |
parent | 9aaccf56a9cb4367a72450911f26cd9b324c3717 (diff) |
fix localization cache, #27276
-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 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) }; |