Bug#688735: Some strings need to be set up for i18n

2018-02-22 Thread Gunnar Hjalmarsson
I have second thoughts about this. I think the cryptroot-script.sh file 
itself is fine, but probably we should avoid to mess with the upstream 
translation template.


The source includes debian/scripts/po/Makefile, which updates 
luksformat.pot and creates and installs luksformat.po files for 
available languages when called from debian/rules. Maybe we should do 
something similar for cryptroot-script.sh (and possibly other files in 
debian/initramfs). Or, instead of adding another distro specific 
template, maybe we should 'merge' them into one template with strings 
from files in both debian/scripts and debian/initramfs. In that case, 
would "cryptsetup-debian" be a suitable template name?


I want to complete the fix of this bug, but before spending more time on 
it I'd like to talk to some package maintainer, so we can agree on the 
approach.


--
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj



Bug#688735: Some strings need to be set up for i18n

2018-02-21 Thread Gunnar Hjalmarsson

I have made an attempt to fix this. Please see the attached patch.

--
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj
>From 63726d9f16de39b94d5bfe85ae5474ab86d77972 Mon Sep 17 00:00:00 2001
From: Gunnar Hjalmarsson 
Date: Wed, 21 Feb 2018 21:23:20 +0100
Subject: [PATCH] Enable translations for the cryptroot script

https://bugs.debian.org/688735, https://launchpad.net/bugs/1027854
---
 .../{cryptroot-script => cryptroot-script.sh}  | 35 +++---
 debian/patches/cryptroot-script-translations.patch | 13 
 debian/patches/series  |  1 +
 debian/rules   |  4 ++-
 4 files changed, 41 insertions(+), 12 deletions(-)
 rename debian/initramfs/{cryptroot-script => cryptroot-script.sh} (84%)
 create mode 100644 debian/patches/cryptroot-script-translations.patch

diff --git a/debian/initramfs/cryptroot-script b/debian/initramfs/cryptroot-script.sh
similarity index 84%
rename from debian/initramfs/cryptroot-script
rename to debian/initramfs/cryptroot-script.sh
index 75299a0..3fa9e67 100644
--- a/debian/initramfs/cryptroot-script
+++ b/debian/initramfs/cryptroot-script.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 PREREQ="cryptroot-prepare"
+export TEXTDOMAIN=cryptsetup
+. /usr/bin/gettext.sh
 
 #
 # Standard initramfs preamble
@@ -165,7 +167,8 @@ parse_options()
 	export CRYPTTAB_OPTIONS
 
 	if [ -z "$cryptsource" ]; then
-		message "cryptsetup ($crypttarget): source parameter missing"
+		# TRANSLATORS: Keep the variable $crypttarget untranslated
+		message $(eval_gettext 'cryptsetup ($crypttarget): source parameter missing')
 		return 1
 	fi
 	return 0
@@ -175,7 +178,8 @@ activate_vg()
 {
 	# Sanity checks
 	if [ ! -x /sbin/lvm ]; then
-		message "cryptsetup ($crypttarget): lvm is not available"
+		# TRANSLATORS: Keep the variable $crypttarget untranslated
+		message $(eval_gettext 'cryptsetup ($crypttarget): lvm is not available')
 		return 1
 	fi
 
@@ -206,7 +210,8 @@ setup_mapping()
 		cryptkeyscript="/lib/cryptsetup/askpass"
 		cryptkey="Please unlock disk $diskname: "
 	elif ! type "$cryptkeyscript" >/dev/null; then
-		message "cryptsetup ($crypttarget): error - script \"$cryptkeyscript\" missing"
+		# TRANSLATORS: Keep the variables $crypttarget and $cryptkeyscript untranslated
+		message $(eval_gettext 'cryptsetup ($crypttarget): error - script "$cryptkeyscript" missing')
 		return 1
 	fi
 
@@ -218,7 +223,8 @@ setup_mapping()
 	fi
 
 	if [ -n "$cryptheader" ] && ! type "$cryptheader" >/dev/null; then
-		message "cryptsetup ($crypttarget): error - LUKS header \"$cryptheader\" missing"
+		# TRANSLATORS: Keep the variables $crypttarget and $cryptheader untranslated
+		message $(eval_gettext 'cryptsetup ($crypttarget): error - LUKS header "$cryptheader" missing')
 		return 1
 	fi
 
@@ -323,13 +329,15 @@ setup_mapping()
 		if [ ! -e "$NEWROOT" ]; then
 			if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \
 			 $cryptkeyscript "$cryptkey" | $cryptopen; then
-message "cryptsetup ($crypttarget): cryptsetup failed, bad password or options?"
+# TRANSLATORS: Keep the variable $crypttarget untranslated
+message $(eval_gettext 'cryptsetup ($crypttarget): cryptsetup failed, bad password or options?')
 continue
 			fi
 		fi
 
 		if [ ! -e "$NEWROOT" ]; then
-			message "cryptsetup ($crypttarget): unknown error setting up device mapping"
+			# TRANSLATORS: Keep the variable $crypttarget untranslated
+			message $(eval_gettext 'cryptsetup ($crypttarget): unknown error setting up device mapping')
 			return 1
 		fi
 
@@ -341,7 +349,8 @@ setup_mapping()
 		#if [ "$FSTYPE" = "lvm" ] || [ "$FSTYPE" = "lvm2" ]; then
 		if [ "$FSTYPE" = "LVM_member" ] || [ "$FSTYPE" = "LVM2_member" ]; then
 			if [ -z "$cryptlvm" ]; then
-message "cryptsetup ($crypttarget): lvm fs found but no lvm configured"
+# TRANSLATORS: Keep the variable $crypttarget untranslated
+message $(eval_gettext 'cryptsetup ($crypttarget): lvm fs found but no lvm configured')
 return 1
 			elif ! activate_vg; then
 # disable error message, LP: #151532
@@ -366,7 +375,8 @@ setup_mapping()
 
 		#if [ -z "$FSTYPE" ] || [ "$FSTYPE" = "unknown" ]; then
 		if [ -z "$FSTYPE" ]; then
-			message "cryptsetup ($crypttarget): unknown fstype, bad password or options?"
+			# TRANSLATORS: Keep the variable $crypttarget untranslated
+			message $(eval_gettext 'cryptsetup ($crypttarget): unknown fstype, bad password or options?')
 			udev_settle
 			$cryptremove
 			continue
@@ -375,15 +385,18 @@ setup_mapping()
 		# decrease $count by 1, apparently last try was successful.
 		count=$(( $count - 1 ))
 
-		message "cryptsetup ($crypttarget): set up successfully"
+		# TRANSLATORS: Keep the variable $crypttarget untranslated
+		message $(eval_gettext 'cryptsetup ($crypttarget): set up successfully')
 		break
 	done
 
 	failsleep=60 # make configurable later?
 
 	if [ "$cryptrootdev" = "yes" ] && [ $crypttries -gt 0 ] && [ $count -ge 

Bug#688735: Some strings need to be set up for i18n

2012-09-25 Thread David Planella
Package: cryptsetup
Version: 2:1.4.3-2

Forwarding downstream bug at: https://bugs.launchpad.net/bugs/1027854

If I use a non-English locale, some strings are untranslated (and
untranslatable) in cryptsetup.

The strings are located in:

debian/scripts/cryptroot-script:

The strings in question are:

cryptsetup: cryptsetup failed, bad password or options?
Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase:
cryptsetup: $crypttarget set up successfully



signature.asc
Description: OpenPGP digital signature