From 4b9f4323abfaa0f4030cc29aed97e0716f9c5852 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 11 Sep 2013 10:18:04 -0400 Subject: libremessages: add a few more message routines, and make them gettext-aware. - Don't set LANG=C in common.sh - Move TEXTDOMAIN stuff into common.sh; so devtools stuff will use it. - Add _(): Basically an alias for `gettext`, but falls back if gettext is not available. - Add panic(): First showed up in `distcc-tool`, does what it sounds like. - Add prose(), bullet(), and flag(): they do word wrapping and such to make it easy to internationalize `--help` text. - Teach common.mk how to make .pot files based on these routines. --- src/lib/common.sh.top | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/common.sh.top') diff --git a/src/lib/common.sh.top b/src/lib/common.sh.top index d59268d..c335956 100644 --- a/src/lib/common.sh.top +++ b/src/lib/common.sh.top @@ -11,3 +11,15 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. + +if [[ -z ${_INCLUDE_COMMON_SH:-} ]]; then +_INCLUDE_COMMON_SH=true + +export TEXTDOMAIN='libretools' +export TEXTDOMAINDIR='/usr/share/locale' + +if type gettext &>/dev/null; then + _() { gettext "$@"; } +else + _() { echo "$@"; } +fi -- cgit v1.2.3-54-g00ecf