Mercurial > pub > Impl
annotate Lib/IMPL/Resources.pm @ 376:a54a2faf2f7e
added localizable string maps
author | cin |
---|---|
date | Mon, 13 Jan 2014 17:52:04 +0400 |
parents | 39842eedd923 |
children | 2eed076cb944 |
rev | line source |
---|---|
49 | 1 package IMPL::Resources; |
2 use strict; | |
3 | |
318 | 4 our $CurrentLocale ||= 'default'; |
49 | 5 |
319 | 6 sub currentLocale { |
318 | 7 $CurrentLocale; |
49 | 8 } |
9 | |
318 | 10 sub SetLocale { |
11 my ($self,$locale) = @_; | |
49 | 12 |
360 | 13 $locale =~ tr/\-/_/; |
14 | |
318 | 15 $CurrentLocale = $locale; |
16 } | |
17 | |
18 sub InvokeInLocale { | |
19 my ($this,$locale,$code) = @_; | |
20 | |
360 | 21 local $CurrentLocale; |
22 $this->SetLocale($locale); | |
318 | 23 eval { |
24 &$code() | |
25 if $code; | |
26 }; | |
27 die $@ | |
28 if $@; | |
49 | 29 } |
30 | |
31 1; |