diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-11 10:18:04 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-11 15:43:36 -0400 |
commit | 4b9f4323abfaa0f4030cc29aed97e0716f9c5852 (patch) | |
tree | 1dca8650a1a5857f180aaa7704b7b7ee3ba77d32 /src/lib/common.sh.top | |
parent | 5bbf15572626010ce6e2bc783d0a980fc24662b2 (diff) |
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.
Diffstat (limited to 'src/lib/common.sh.top')
-rw-r--r-- | src/lib/common.sh.top | 12 |
1 files changed, 12 insertions, 0 deletions
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 |