From 7d434787b607ee2567c6d683b6f872c1e65baea2 Mon Sep 17 00:00:00 2001 From: gdrooid Date: Mon, 11 Aug 2014 22:56:26 +0200 Subject: [PATCH 1/3] Install and use translations. --- Makefile | 1 + extras/po/Makefile | 9 +++++++++ tomb | 14 +++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4d5d68f..4093956 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ all: install: @install -Dm755 ${PROG} ${DESTDIR}${PREFIX}/bin/${PROG} @install -Dm666 doc/${PROG}.1 ${DESTDIR}${MANDIR}/man1/${PROG}.1 + make -C extras/po install test: make -C extras/test diff --git a/extras/po/Makefile b/extras/po/Makefile index 743e22d..c5656c9 100644 --- a/extras/po/Makefile +++ b/extras/po/Makefile @@ -1,4 +1,13 @@ +LOCALEDIR ?= /usr/share/locale +TOMBFILE = LC_MESSAGES/tomb.po + all: @rm -f tomb.pot @./generate_translatable_strings.sh > tomb.pot @echo "Strings generated in tomb.pot" + +install: *.mo + @install -Dm755 es.mo ${LOCALEDIR}/es/${TOMBFILE} + +es.mo: es.po + msgfmt -o $@ $< diff --git a/tomb b/tomb index a2a41b0..ee67d8d 100755 --- a/tomb +++ b/tomb @@ -69,6 +69,9 @@ typeset -H tomb_secret # Make sure sbin is in PATH PATH+=:/sbin:/usr/sbin +# For gettext +export TEXTDOMAIN=tomb + # }}} # {{{ Safety functions @@ -410,9 +413,10 @@ option_value() { # Messaging function with pretty coloring function _msg() { + local msg="$(gettext -s "$2")" local command="print -P" local progname="$fg[magenta]${TOMBEXEC##*/}$reset_color" - local message="$fg_bold[normal]$fg_no_bold[normal]${2}$reset_color" + local message="$fg_bold[normal]$fg_no_bold[normal]$msg$reset_color" local -i returncode case "$1" in @@ -420,19 +424,19 @@ function _msg() { command+=" -n"; pchars=" > "; pcolor="yellow" ;; message) - pchars=" . "; pcolor="white"; message="$fg_no_bold[$pcolor]${2}$reset_color" + pchars=" . "; pcolor="white"; message="$fg_no_bold[$pcolor]$msg$reset_color" ;; verbose) pchars="[D]"; pcolor="blue" ;; success) - pchars="(*)"; pcolor="green"; message="$fg_no_bold[$pcolor]${2}$reset_color" + pchars="(*)"; pcolor="green"; message="$fg_no_bold[$pcolor]$msg$reset_color" ;; warning) - pchars="[W]"; pcolor="yellow"; message="$fg_no_bold[$pcolor]${2}$reset_color" + pchars="[W]"; pcolor="yellow"; message="$fg_no_bold[$pcolor]$msg$reset_color" ;; failure) - pchars="[E]"; pcolor="red"; message="$fg_no_bold[$pcolor]${2}$reset_color" + pchars="[E]"; pcolor="red"; message="$fg_no_bold[$pcolor]$msg$reset_color" returncode=1 ;; *) From 6ff2b86dfc70925909647e9ab597a75653d664d2 Mon Sep 17 00:00:00 2001 From: gdrooid Date: Sun, 17 Aug 2014 21:37:13 +0200 Subject: [PATCH 2/3] Revert changes to the main Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 4093956..4d5d68f 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,6 @@ all: install: @install -Dm755 ${PROG} ${DESTDIR}${PREFIX}/bin/${PROG} @install -Dm666 doc/${PROG}.1 ${DESTDIR}${MANDIR}/man1/${PROG}.1 - make -C extras/po install test: make -C extras/test From 907da7bf7b3bcd49c58c2ea4acac2482a1af8dd8 Mon Sep 17 00:00:00 2001 From: gdrooid Date: Sun, 17 Aug 2014 22:06:40 +0200 Subject: [PATCH 3/3] Add instructions to install translations. --- INSTALL.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index ddae231..dca8beb 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -63,3 +63,11 @@ Once any of the above is installed Tomb will find the tool automatically. Tomb comes with a bunch of extra tools that contribute to enhance its functionality or integrate it into particular system environments. +### Install translations + +There are translations available for Tomb. If you wish to install them +navigate to extras/po and run 'make install' as root: + + cd extras/po + sudo make install +