view Lib/IMPL/Resources.pm @ 318:1838bdb4d238

corrected support of resources localization
author cin
date Tue, 14 May 2013 03:38:47 +0400
parents 16ada169ca75
children d485467eca92
line wrap: on
line source

package IMPL::Resources;
use strict;

our $CurrentLocale ||= 'default';

sub CurrentLocale {
    $CurrentLocale;
}

sub SetLocale {
    my ($self,$locale) = @_;
    
    $CurrentLocale = $locale;
}

sub InvokeInLocale {
    my ($this,$locale,$code) = @_;

    local $CurrentLocale = $locale;    
    eval {
        &$code()
            if $code;
    };
    die $@
        if $@;
}

1;