view Lib/IMPL/Resources.pm @ 338:c78dfbe658bd

improved string maps loading for TT documents
author cin
date Sat, 15 Jun 2013 02:32:11 +0400
parents d485467eca92
children 39842eedd923
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;