[pacman-dev] [RFC v2 13/13] bacman: make gettext useful

Gordian Edenhofer gordian.edenhofer at gmail.com
Thu Sep 29 12:41:26 UTC 2016


Export TEXTDOMAIN and TEXTDOMAINDIR in order for the strings to be
translatable with gettext.
---
 contrib/bacman.sh.in | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
index 39fbe99..cce5a1e 100644
--- a/contrib/bacman.sh.in
+++ b/contrib/bacman.sh.in
@@ -32,6 +32,17 @@ QUIET=0
 # Required for fakeroot because options are shifted off the array.
 ARGS=("$@")
 
+# gettext initialization
+export TEXTDOMAIN='pacman'
+export TEXTDOMAINDIR='@localedir@'
+
+# Determine whether we have gettext; make it a no-op if we do not
+if ! type -p gettext >/dev/null; then
+	gettext() {
+		printf "%s\n" "$@"
+	}
+fi
+
 m4_include(../scripts/library/output_format.sh)
 m4_include(../scripts/library/parseopts.sh)
 
-- 
2.10.0


More information about the pacman-dev mailing list