Mercurial > pub > Impl
annotate Lib/IMPL/Resources.pm @ 381:ced5937ff21a
Custom getters/setters support method names in theirs definitions
Initial support for localizable labels in DOM schemas
author | cin |
---|---|
date | Wed, 22 Jan 2014 16:56:10 +0400 |
parents | 2eed076cb944 |
children |
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); | |
378 | 23 |
24 &$code() | |
25 if $code; | |
49 | 26 } |
27 | |
28 1; |