Signed-off-by: Gordian Edenhofer <gordian.edenho...@gmail.com> --- contrib/rankmirrors.sh.in | 48 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/contrib/rankmirrors.sh.in b/contrib/rankmirrors.sh.in index 0988fe9..e1e0503 100644 --- a/contrib/rankmirrors.sh.in +++ b/contrib/rankmirrors.sh.in @@ -24,23 +24,45 @@ 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 %s. It can also rank one mirror if the URL is\n\ +provided")\n" "@sysconfdir@/pacman.d/" 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 -- " -h, --help " + printf -- "$(gettext "Show this help message and exit")\n" + printf -- " -n <N> " + printf -- "$(gettext "Number of servers to output, 0 for all")\n" + printf -- " -t, --times " + printf -- "$(gettext "Only output mirrors and their response times")\n" + printf -- " -u, --url " + printf -- "$(gettext "Test a specific URL")\n" + printf -- " -v, --verbose " + printf -- "$(gettext "Be verbose in ouptut")\n" + printf -- " -r, --repo <repo> " + printf -- "$(gettext "Specify a repository name instead of guessing")\n" + printf -- " --version " + printf -- "$(gettext "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