| 1 | package QBit::Application::_Utils::TmpLocale; | ||
| 2 | $QBit::Application::_Utils::TmpLocale::VERSION = '0.017'; | ||
| 3 | use qbit; | ||
| 4 | |||
| 5 | use base qw(QBit::Class); | ||
| 6 | |||
| 7 | sub init { | ||
| 8 | my ($self) = @_; | ||
| 9 | |||
| 10 | my @missed_required_params = grep {!exists($self->{$_})} qw(app old_locale); | ||
| 11 | throw Exception::BadArguments gettext('Missed requred fields "%s"', join(', ', @missed_required_params)) | ||
| 12 | if @missed_required_params; | ||
| 13 | } | ||
| 14 | |||
| 15 | sub DESTROY { | ||
| 16 | my ($self) = @_; | ||
| 17 | |||
| 18 | $self->{'app'}->set_app_locale($self->{'old_locale'}); | ||
| 19 | } | ||
| 20 | |||
| 21 | TRUE; |