Package: po4a
Version: 0.44-1
Severity: normal
Tags: patch
Hi,
The key/parameter of an Ini file is a useful context for translating ini
files, please include the ini key as po comment when using
po4a-gettextize. e.g.:
A="Translatable"
B="Iternationalisation"
=>
#. A=
#: test.ini:1
#, no-wrap
msgid "Translatable"
msgstr ""
…
A patch to do so is attached.
Cheers,
OdyX
--- /usr/share/perl5/Locale/Po4a/Ini.pm 2012-10-21 02:10:32.000000000 +0200
+++ /tmp/Ini.pm 2012-12-30 13:54:02.296267735 +0100
@@ -57,8 +57,11 @@
# Remove starting and ending quotes from the translation text, if any
$quoted_text =~ s/^"//g;
$quoted_text =~ s/"$//g;
+ # Try to get key from ini line
+ my $key = $pre_text;
+ $key =~ s/"$//g;
# Translate the string it
- $par = $self->translate($quoted_text, $ref);
+ $par = $self->translate($quoted_text, $ref, "", comment => $key);
# Escape the \n characters
$par =~ s/\n/\\n/g;
# Now push the result