Signed-off-by: Gordian Edenhofer <gordian.edenho...@gmail.com>
---
 contrib/rankmirrors.sh.in | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in
index 0988fe9..bd65d73 100644
--- a/contrib/rankmirrors.sh.in
+++ b/contrib/rankmirrors.sh.in
@@ -24,23 +24,38 @@ trap finaloutput INT
 declare -r myname='rankmirrors'
 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/parseopts.sh)
+
 usage() {
-       echo "${myname} (pacman) v${myver}"
+       printf "%s (pacman) %s\n" "$myname" "$myver"
+       echo
+       printf -- "$(gettext "\
+Ranks pacman mirrors by their connection and opening speed. Pacman mirror\n\
+files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if 
the URL is\n\
+provided")\n"
        echo
-       echo "Ranks pacman mirrors by their connection and opening speed. 
Pacman mirror"
-       echo "files are located in @sysconfdir@/pacman.d/. It can also rank one 
mirror if the URL is"
-       echo "provided."
+       printf -- "$(gettext "Usage: %s [options] <mirrorfile|URL>")\n" "$0"
        echo
-       echo "Usage: ${myname} [options] MIRRORFILE | URL"
+       printf -- "$(gettext "Options:")\n"
+       printf -- "$(gettext "  -h, --help         Show this help message and 
exit")\n"
+       printf -- "$(gettext "  -n <N>             Number of servers to output, 
0 for all")\n"
+       printf -- "$(gettext "  -t, --times        Only output mirrors and 
their response times")\n"
+       printf -- "$(gettext "  -u, --url          Test a specific URL")\n"
+       printf -- "$(gettext "  -v, --verbose      Be verbose in ouptut")\n"
+       printf -- "$(gettext "  -r, --repo <repo>  Specify a repository name 
instead of guessing")\n"
+       printf -- "$(gettext "  --version          Show program's version 
number and exit")\n"
        echo
-       echo "Options:"
-       echo "  --version      show program's version number and exit"
-       echo "  -h, --help     show this help message and exit"
-       echo "  -n NUM         number of servers to output, 0 for all"
-       echo "  -t, --times    only output mirrors and their response times"
-       echo "  -u, --url      test a specific URL"
-       echo "  -v, --verbose  be verbose in ouptut"
-       echo "  -r, --repo     specify a repository name instead of guessing"
 }
 
 version() {
-- 
2.10.0

Reply via email to