58 lines
1.5 KiB
Perl
58 lines
1.5 KiB
Perl
# Selima Website Content Management System
|
|
# ErrMsg.pm: The Maketext error message composer.
|
|
|
|
# Copyright (c) 2003-2018 imacat.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Author: imacat <imacat@mail.imacat.idv.tw>
|
|
# First written: 2003-03-23
|
|
|
|
package Selima::ErrMsg;
|
|
use 5.008;
|
|
use strict;
|
|
use warnings;
|
|
use base qw(Exporter);
|
|
use vars qw(@EXPORT @EXPORT_OK);
|
|
BEGIN {
|
|
@EXPORT = qw(err2msg);
|
|
@EXPORT_OK = @EXPORT;
|
|
# Prototype declaration
|
|
sub err2msg($);
|
|
}
|
|
|
|
use Selima::DataVars qw(:l10n :lninfo);
|
|
use Selima::LnInfo;
|
|
use Selima::ShortCut;
|
|
|
|
# err2msg: Compose the error message from the $error hash reference
|
|
sub err2msg($) {
|
|
local (%_, $_);
|
|
my $status;
|
|
$status = $_[0];
|
|
# Empty string
|
|
return "" if !exists $$status{"msg"};
|
|
$_ = $$status{"msg"};
|
|
@_ = qw();
|
|
@_ = @{$$status{"margs"}} if exists $$status{"margs"};
|
|
foreach (@_) {
|
|
if ($_ eq "_DEFAULT_LANG") {
|
|
$_ = h(ln $DEFAULT_LANG, LN_DESC_CURLC);
|
|
}
|
|
}
|
|
# Maketext
|
|
return F_($_, @_);
|
|
}
|
|
|
|
return 1;
|