annotate Lib/IMPL/Resources.pm @ 368:010ceafd0c5a

form metadata + tests
author cin
date Wed, 04 Dec 2013 17:31:53 +0400
parents 39842eedd923
children 2eed076cb944
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
1 package IMPL::Resources;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
3
318
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
4 our $CurrentLocale ||= 'default';
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
5
319
d485467eca92 small fixes
cin
parents: 318
diff changeset
6 sub currentLocale {
318
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
7 $CurrentLocale;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
8 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
9
318
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
10 sub SetLocale {
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
11 my ($self,$locale) = @_;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
12
360
39842eedd923 language detection from request
sergey
parents: 319
diff changeset
13 $locale =~ tr/\-/_/;
39842eedd923 language detection from request
sergey
parents: 319
diff changeset
14
318
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
15 $CurrentLocale = $locale;
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
16 }
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
17
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
18 sub InvokeInLocale {
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
19 my ($this,$locale,$code) = @_;
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
20
360
39842eedd923 language detection from request
sergey
parents: 319
diff changeset
21 local $CurrentLocale;
39842eedd923 language detection from request
sergey
parents: 319
diff changeset
22 $this->SetLocale($locale);
318
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
23 eval {
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
24 &$code()
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
25 if $code;
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
26 };
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
27 die $@
1838bdb4d238 corrected support of resources localization
cin
parents: 49
diff changeset
28 if $@;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
29 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
30
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
31 1;