view Lib/IMPL/Resources.pm @ 364:82b6c967bcf1

sync, working on metadata
author cin
date Fri, 29 Nov 2013 16:33:07 +0400
parents 39842eedd923
children 2eed076cb944
line wrap: on
line source

package IMPL::Resources;
use strict;

our $CurrentLocale ||= 'default';

sub currentLocale {
    $CurrentLocale;
}

sub SetLocale {
    my ($self,$locale) = @_;
    
    $locale =~ tr/\-/_/;
    
    $CurrentLocale = $locale;
}

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

    local $CurrentLocale;
    $this->SetLocale($locale);    
    eval {
        &$code()
            if $code;
    };
    die $@
        if $@;
}

1;