[pacman-dev] [RFC v3 05/13] checkupdates: streamline usage function

Gordian Edenhofer gordian.edenhofer at gmail.com
Fri Sep 30 11:47:53 UTC 2016


Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
 contrib/checkupdates.sh.in | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/contrib/checkupdates.sh.in b/contrib/checkupdates.sh.in
index ff62891..40a13ec 100644
--- a/contrib/checkupdates.sh.in
+++ b/contrib/checkupdates.sh.in
@@ -21,17 +21,29 @@
 declare -r myname='checkupdates'
 declare -r myver='@PACKAGE_VERSION@'
 
+# 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/term_colors.sh)
 
 if (( $# > 0 )); then
-	echo "${myname} (pacman) v${myver}"
+	printf "%s (pacman) %s\n" "$myname" "$myver"
+	echo
+	printf -- "$(gettext "Safely print a list of pending updates")\n"
 	echo
-	echo "Safely print a list of pending updates"
+	printf -- "$(gettext "Usage: %s")\n" "$0"
 	echo
-	echo "Usage: ${myname}"
+	printf -- "$(gettext "Note: Export the "%s" variable to change the path of the temporary database.")\n" "CHECKUPDATES_DB"
 	echo
-	echo 'Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.'
 	exit 0
 fi
 
-- 
2.10.0


More information about the pacman-dev mailing list