X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main_Mixin.pm;h=d493060f0c7cf445b4b0ccaaa35994ffda8f8426;hb=3c54c844c665ed108c7892a154fd3972fab1f3e5;hp=e8e243f2d5d2278c5e0cfda4545957300a773604;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a;p=freeside.git diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm index e8e243f2d..d493060f0 100644 --- a/FS/FS/cust_main_Mixin.pm +++ b/FS/FS/cust_main_Mixin.pm @@ -538,6 +538,41 @@ sub process_email_search_result { } +=item conf + +Returns a configuration handle (L) set to the customer's locale, +if they have one. If not, returns an FS::Conf with no locale. + +=cut + +sub conf { + my $self = shift; + return $self->{_conf} if (ref $self and $self->{_conf}); + my $cust_main = $self->cust_main; + my $conf = new FS::Conf { + 'locale' => ($cust_main ? $cust_main->locale : '') + }; + $self->{_conf} = $conf if ref $self; + return $conf; +} + +=item mt TEXT [, ARGS ] + +Localizes a text string (see L) for the customer's locale, +if they have one. + +=cut + +sub mt { + my $self = shift; + return $self->{_lh}->maketext(@_) if (ref $self and $self->{_lh}); + my $cust_main = $self->cust_main; + my $locale = $cust_main ? $cust_main->locale : ''; + my $lh = FS::L10N->get_handle($locale); + $self->{_lh} = $lh if ref $self; + return $lh->maketext(@_); +} + =back =head1 BUGS