Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (58 sloc) 1.906 kb
# Copyright 2002-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
# $Id: msg.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $
UserTag msg Order key
UserTag msg addAttr
UserTag msg attrAlias lc inline
UserTag msg hasEndTag
UserTag msg Interpolate
UserTag msg PosNumber 1
UserTag msg Version $Revision: 1.4 $
UserTag msg Routine <<EOR
sub {
my ($key, $opt, $body) = @_;
my (@args, $message, $out, $startlocale);
unless ($opt->{raw}) {
if (ref $opt->{arg} eq 'ARRAY') {
@args = @{ $opt->{arg} };
} elsif (ref $opt->{arg} eq 'HASH') {
@args = map { $opt->{arg}->{$_} } sort keys %{ $opt->{arg} };
} elsif (! ref $opt->{arg}) {
@args = $opt->{arg};
}
}
if ($opt->{locale}) {
# we only mess with scratch mv_locale because
# Vend::Util::find_locale_bit uses it to determine current locale
$startlocale = $::Scratch->{mv_locale};
Vend::Util::setlocale($opt->{locale}, undef, { persist => 1 });
}
if ($opt->{inline}) {
$message = Vend::Util::find_locale_bit($body);
} else {
$message = $body;
}
if ($key) {
if ($Vend::Cfg->{Locale} and defined $Vend::Cfg->{Locale}{$key}) {
$message = $Vend::Cfg->{Locale}{$key};
} elsif ($Global::Locale and defined $Global::Locale->{$key}) {
$message = $Global::Locale->{$key};
}
}
if ($opt->{raw}) {
$out = $message;
} else {
$out = errmsg($message, @args);
}
if ($opt->{locale}) {
$::Scratch->{mv_locale} = $startlocale;
Vend::Util::setlocale();
}
return $out;
}
EOR
Jump to Line
Something went wrong with that request. Please try again.