libtranslate.lib: new library

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-11-30 22:02:42 +01:00
parent 6a8aa06630
commit 6b8099f31d
16 changed files with 93 additions and 63 deletions

View File

@ -18,6 +18,15 @@ Changes in version 1.16.1
The variables PO_COPYRIGH_HOLDER and PO_BUGS_ADDRESS are no longer
required. Remove them.
+ update
* lib/libtranslate.lib - Davide Madrisan:
New library libtranslate.lib.
+ update
* lib/*, plugins/*, tests/* - Davide Madrisan:
Use libtranslate.lib instead of duplicate the code in every library,
plugin, and test module.
-------------------------------------------------------------------------------
Changes in version 1.16.0

View File

@ -19,7 +19,7 @@ srcdir = ..
include $(srcdir)/Makefile.env
pck_libs := libapse.lib libcfg.lib libmsgmng.lib libnetwork.lib libspec.lib \
libtest.lib
libtest.lib libtranslate.lib
pck_libs_infiles := $(wildcard *.in)
pck_libs_all := $(pck_libs) README.API

View File

@ -9,6 +9,8 @@ libapse_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("libapse.lib" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }

View File

@ -8,16 +8,17 @@ libcfg_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("libcfg.lib" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# list of the configuration file(s)
default_cfg_list=(\

View File

@ -8,11 +8,12 @@ libmsgmng_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
me=("libmsgmng.lib" "@version@" "@date@")
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# notify family of message handling functions:
# - notify.warning

View File

@ -8,18 +8,17 @@ libnetwork_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] &&
{ echo $"this script requires bash version 3 or better" >&2 && exit 1; }
me=(${0##*/} "@version@" "@date@")
me=("libnetwork.lib" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# check if all the needed tools are available
# note: 'host' has been removed from this list because the package

View File

@ -8,16 +8,17 @@ libspec_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("libspec.lib" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# function boolexpr.solve
# calculate the boolean expression `$1' expanding the variables

View File

@ -8,18 +8,17 @@ libtest_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] &&
{ echo $"this script requires bash version 3 or better" >&2 && exit 1; }
me=(${0##*/} "@version@" "@date@")
me=("libtest.lib" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
[ -n "$testdir" ] ||
notify.error "\`testdir': "$"unset in the configuration files"

19
lib/libtranslate.lib.in Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# libtranslate.lib -- @package@ library used to setup translations
# Copyright (C) 2012 Davide Madrisan <davide.madrisan@gmail.com>
[ "$libtranslate_is_loaded" = 1 ] || {
libtest_is_loaded=1
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
{ echo $"this script requires bash version 2 or better" >&2 && exit 1; }
me=("libtranslate.lib" "@version@" "@date@")
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
} # endif $libtranslate_is_loaded

View File

@ -22,11 +22,10 @@ let "verbose = 1"
exit 1; }
. @libdir@/libcfg.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
function copying() {
echo "\

View File

@ -27,11 +27,10 @@ let "verbose = 1"
exit 1; }
. @libdir@/libnetwork.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
function copying() {
echo "\

View File

@ -64,11 +64,10 @@ unset ignore_test_list
exit 1; }
. @libdir@/libcfg.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
function copying() {
echo "\

View File

@ -66,11 +66,10 @@ preserve_dot_git=0
exit 1; }
. @libdir@/libcfg.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
function copying() {
echo "\

View File

@ -5,17 +5,18 @@
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("test00_specsyntax" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# check if all the needed tools are available
for tool in cat file getopt grep sed; do

View File

@ -5,17 +5,18 @@
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("test01_pkgquality" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# check if all the needed tools are available
for tool in file find getopt grep ls ldd; do

View File

@ -5,17 +5,18 @@
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("test02_pkgsecurity" "@version@" "@date@")
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
[ "$LANG" ] && export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libtranslate.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libtranslate.lib" 1>&2
exit 1; }
. @libdir@/libtranslate.lib
# check if all the needed tools are available
for tool in file find getopt grep objdump sed; do