aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFrank Lichtenheld <frank@lichtenheld.de>2008-08-21 14:43:33 +0200
committerFrank Lichtenheld <frank@lichtenheld.de>2008-08-21 14:43:33 +0200
commitbe05848488b9d81df046d2adadb671f4ee34315c (patch)
tree21b69382b5d2cf4d66847add41a9bf5f3bf6235a /bin
parentd3634cc475c6de2a95542b8169e22df0ce766d67 (diff)
debtags-xgettext: Handle linebreaks (and other whitespace) a little more sanely
Do not include linebreaks from the vocabulary file in the msgids. Replace \n.\n with a single linebreak. Remove the single whitespace at the beginning of the long description and new paragraphs. Together these changes should make it easier for translators to translate the long descriptions. fix_old_debtags_po: Script to convert the old .po files to the new format so that translators don't have to do that manually.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/debtags-xgettext4
-rwxr-xr-xbin/fix_old_debtags_po12
2 files changed, 15 insertions, 1 deletions
diff --git a/bin/debtags-xgettext b/bin/debtags-xgettext
index a7f718b..329288b 100755
--- a/bin/debtags-xgettext
+++ b/bin/debtags-xgettext
@@ -18,7 +18,8 @@ sub escape {
my $text = shift;
$text =~ s/\\/\\\\/g;
$text =~ s/"/\\"/g;
- $text =~ s/\n/\\n/g;
+ $text =~ s/\n\s*\.\n\s?/\\n/g;
+ $text =~ s/\n//g;
$text =~ s/\t/\\t/g;
return $text;
}
@@ -59,6 +60,7 @@ sub processFile {
if ($long) {
$long = escape($long);
+ $long =~ s/^\s//;
push (@msgids, $long);
push (@{$messages->{$long}}, $comment.", long desc", $file);
}
diff --git a/bin/fix_old_debtags_po b/bin/fix_old_debtags_po
new file mode 100755
index 0000000..86153b1
--- /dev/null
+++ b/bin/fix_old_debtags_po
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+for i in po/debtags.*.po
+do
+ perl -i -p -e 'if (/^\s*$/) { $seen=1 };
+ if ($begin) { s/^"\s/"/ } $begin=0;
+ s/^(msg(id|str) ")\s/$1/;
+ if ($seen) { s/^"\s*\.\\n"/"\001"/g; s/\s*\\n//g; s/\001/\\n/g }
+ if (/^msg(id|str) ""/) { $begin=1 };
+ if (/^"\\n"/) { $begin=2 };
+ ' $i
+done