Mercurial > pub > Impl
annotate 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 |
| 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 |
| 318 | 13 $CurrentLocale = $locale; |
| 14 } | |
| 15 | |
| 16 sub InvokeInLocale { | |
| 17 my ($this,$locale,$code) = @_; | |
| 18 | |
| 19 local $CurrentLocale = $locale; | |
| 20 eval { | |
| 21 &$code() | |
| 22 if $code; | |
| 23 }; | |
| 24 die $@ | |
| 25 if $@; | |
| 49 | 26 } |
| 27 | |
| 28 1; |
