* Add enclair_db option to UserDB.pm. Allows logging of enclair password
[interchange.git] / code / UserTag / loc.tag
1 # Copyright 2002-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 # $Id: loc.tag,v 1.7 2007-03-30 23:40:57 pajamian Exp $
9
10 # [loc locale*] message [/loc]
11 #
12 # This tag is the equivalent of [L] ... [/L] localization, except
13 # it works with contained tags
14 #
15 UserTag loc Order       locale
16 UserTag l   Alias       loc
17 UserTag loc hasEndTag   1
18 UserTag loc Interpolate 1
19 UserTag loc Version     $Revision: 1.7 $
20 UserTag loc Routine     <<EOF
21 sub {
22     my ($locale, $message) = @_;
23     if($::Pragma->{no_locale_parse}) {
24                 ## Need to do this but might have side-effects in PreFork mode
25                 undef $Vend::Parse::myRefs{Alias}{l};
26                 my $begin = '[L';
27                 $begin .= " $locale" if $locale;
28                 $begin .= ']';
29                 return $begin . $message . '[/L]';
30         }
31     return $message unless $Vend::Cfg->{Locale};
32     my $ref;
33     if($locale) {
34         return $message
35             unless defined $Vend::Cfg->{Locale_repository}{$locale};
36         $ref = $Vend::Cfg->{Locale_repository}{$locale}
37     }
38     else {
39         $ref = $Vend::Cfg->{Locale};
40     }
41     return defined $ref->{$message} ? $ref->{$message} : $message;
42 }
43 EOF