summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2008-10-29 09:36:29 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:43 +0100
commitb28ffecee0815d624a17e77bb372450224ca27c4 (patch)
treed758cec2a4640aa4b7999e040d85a631fe0c860b
parent37d2fb4b0f5ac4c92ca589ab46d567f06551971f (diff)
downloadlive-build-b28ffecee0815d624a17e77bb372450224ca27c4.zip
live-build-b28ffecee0815d624a17e77bb372450224ca27c4.tar.gz
Check for availability of gettext at runtime, and only use it if existing.
-rw-r--r--debian/control3
-rwxr-xr-xfunctions/echo.sh42
-rwxr-xr-xfunctions/l10n.sh21
3 files changed, 53 insertions, 13 deletions
diff --git a/debian/control b/debian/control
index dee2995..3c4b8f0 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,8 @@ Vcs-Git: git://git.debian.net/git/debian-live/live-helper.git
Package: live-helper
Architecture: all
-Depends: debootstrap | cdebootstrap, gettext-base
+Depends: debootstrap | cdebootstrap
+Recommends: gettext-base
Suggests: dosfstools, genisoimage, memtest86+ | memtest86, mtools, parted, squashfs-tools | genext2fs | mtd-tools, sudo | fakeroot, syslinux | grub, uuid-runtime, win32-loader
Description: Debian Live build scripts
live-helper is a set of scripts to build Debian Live system images.
diff --git a/functions/echo.sh b/functions/echo.sh
index 47a89c4..93875ea 100755
--- a/functions/echo.sh
+++ b/functions/echo.sh
@@ -12,7 +12,12 @@ Echo ()
STRING="${1}"
shift
- printf "$(eval_gettext "${STRING}")" "${@}"; echo;
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "${STRING}\n"
+ else
+ printf "$(eval_gettext "${STRING}")" "${@}"; echo;
+ fi
}
Echo_debug ()
@@ -22,7 +27,12 @@ Echo_debug ()
if [ "${LH_DEBUG}" = "enabled" ]
then
- printf "D: $(eval_gettext "${STRING}")" "${@}"; echo;
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "D: ${STRING}\n"
+ else
+ printf "D: $(eval_gettext "${STRING}")" "${@}"; echo;
+ fi
fi
}
@@ -31,7 +41,12 @@ Echo_error ()
STRING="${1}"
shift
- (printf "E: $(eval_gettext "${STRING}")" "${@}"; echo;) >&2
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "E: ${STRING}\n" >&2
+ else
+ (printf "E: $(eval_gettext "${STRING}")" "${@}"; echo;) >&2
+ fi
}
Echo_message ()
@@ -41,7 +56,12 @@ Echo_message ()
if [ "${LH_QUIET}" != "enabled" ]
then
- printf "P: $(eval_gettext "${STRING}")" "${@}"; echo;
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "P: ${STRING}\n"
+ else
+ printf "P: $(eval_gettext "${STRING}")" "${@}"; echo;
+ fi
fi
}
@@ -52,7 +72,12 @@ Echo_verbose ()
if [ "${LH_VERBOSE}" = "enabled" ]
then
- printf "I: $(eval_gettext "${STRING}")" "${@}"; echo;
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "I: ${STRING}\n"
+ else
+ printf "I: $(eval_gettext "${STRING}")" "${@}"; echo;
+ fi
fi
}
@@ -61,7 +86,12 @@ Echo_warning ()
STRING="${1}"
shift
- printf "W: $(eval_gettext "${STRING}")" "${@}"; echo;
+ if [ "${LH_L10N}" = "false" ]
+ then
+ printf "W: ${STRING}\n"
+ else
+ printf "W: $(eval_gettext "${STRING}")" "${@}"; echo;
+ fi
}
Echo_breakage ()
diff --git a/functions/l10n.sh b/functions/l10n.sh
index dfb22cb..a1125ec 100755
--- a/functions/l10n.sh
+++ b/functions/l10n.sh
@@ -7,9 +7,18 @@
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
-# gettext domain (.mo file name)
-export TEXTDOMAIN=live-helper
-# locale dir for gettext codes
-export TEXTDOMAINDIR=/usr/share/locale
-# load gettext functions
-. gettext.sh
+if [ -x "$(which gettext.sh 2>/dev/null)" ]
+then
+ LH_L10N="enabled"
+
+ # gettext domain (.mo file name)
+ export TEXTDOMAIN="live-helper"
+
+ # locale dir for gettext codes
+ export TEXTDOMAINDIR="/usr/share/locale"
+
+ # load gettext functions
+ . gettext.sh
+else
+ LH_L10N="disabled"
+fi