[kupfer] Localize helper script kupfer-exec



commit afed7c128165c1db56e936bcd688b4c8f30b62f6
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Feb 10 18:34:22 2010 +0100

    Localize helper script kupfer-exec
    
    Use bash localization to localize the single message in kupfer-exec
    that must be translated.
    
    Not finding a good way to let intltool extract the strings inside
    kupfer-exec, we simply define the same strings in kupfer/version.py to
    put them in the catalog.
    
    Note: you can extract manually with::
    
        bash --dump-po-strings bin/kupfer-exec
    
    Also notice that the order of definition for the TEXTDOMAIN and
    TEXTDOMAINDIR variables is important.

 bin/{kupfer-exec => kupfer-exec.in} |    9 +++++++--
 kupfer/version.py                   |    4 ++++
 wscript                             |   10 ++++++++--
 3 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/bin/kupfer-exec b/bin/kupfer-exec.in
similarity index 65%
rename from bin/kupfer-exec
rename to bin/kupfer-exec.in
index 2bc8d18..3540313 100755
--- a/bin/kupfer-exec
+++ b/bin/kupfer-exec.in
@@ -1,8 +1,11 @@
-#!/bin/sh
+#!/bin/bash
 
 # This is a helper program to execute saved command files,
 # by sending them to a running instance of Kupfer.
 
+export TEXTDOMAIN='@PACKAGE@'
+export TEXTDOMAINDIR='@LOCALEDIR@'
+
 if test ! -f "$1"
 then
 	echo "A file argument required"
@@ -19,7 +22,9 @@ do
 
 	if test $KUPFER_RUNNING != 0
 	then
-		zenity --info --text "Kupfer was not found running" &
+		# NOTE: If you change this string, you have to change
+		# it inside kupfer/version.py as well.
+		zenity --info --text $"Could not find running Kupfer" &
 		exit 1
 	fi
 	shift
diff --git a/kupfer/version.py b/kupfer/version.py
index de62359..4c56e64 100644
--- a/kupfer/version.py
+++ b/kupfer/version.py
@@ -69,3 +69,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """)
+
+# follows strings used elsewhere
+
+_("Could not find running Kupfer")
diff --git a/wscript b/wscript
index 40524a3..466d1a5 100644
--- a/wscript
+++ b/wscript
@@ -197,14 +197,20 @@ def build(bld):
 	# We have to put this in an intermediate build directory,
 	# inside data/ not to clash with the 'kupfer' module(!)
 	binary_subst_file = "kupfer-activate.sh"
-	bin = bld.new_task_gen("subst",
+	bld.new_task_gen("subst",
 		source = binary_subst_file,
 		target = "bin/kupfer",
 		install_path = "${BINDIR}",
 		chmod = 0755,
 		dict = _dict_slice(bld.env, "PYTHON PYTHONDIR".split())
 		)
-	bld.install_files("${BINDIR}", "bin/kupfer-exec", chmod=0755)
+	bld.new_task_gen("subst",
+		source = "bin/kupfer-exec.in",
+		target = "bin/kupfer-exec",
+		install_path = "${BINDIR}",
+		chmod = 0755,
+		dict = _dict_slice(bld.env, "PACKAGE LOCALEDIR".split())
+		)
 
 	# Documentation
 	if bld.env["RST2MAN"]:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]