annotate Lib/IMPL/Resources.pm @ 379:a471e8b77544

sync
author cin
date Thu, 16 Jan 2014 18:10:50 +0400
parents 2eed076cb944
children
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);
378
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents: 360
diff changeset
23
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents: 360
diff changeset
24 &$code()
2eed076cb944 rewritten IMPL::Resources::Strings + tests
cin
parents: 360
diff changeset
25 if $code;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
26 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
27
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 0
diff changeset
28 1;