Package: po4a
Version: 0.45-1
Severity: wishlist
Tags: patch
Hi!
gettext 0.19 got support for a new --add-location option in several of
its msg tools, which allows to specify how the source references get
injected into “#: ...” comments in .po files.
The --add-location option accepts as argument: never, file, and full;
With full being the default, and file only injecting the source
filename w/o a line number.
po4a already has the --porefs option, but at least the “noline” type is
using a hack I assume for backwards compatibility, as it always appends
a line number equal to 1. So I'd like to request that either the “noline”
type stops adding :1 and starts making use of --add-location=file but
that would require a newer gettext, or that a new “file” type gets added
that enables that option on msgmerge and other similar tools.
Something like the attached untested patch, perhaps? I didn't touch
po4a-updatepo because I just realized it does not honor --porefs
contrary to what its documentation says. I've not checked if the other
msg tools would need to be passed the option too.
Thanks,
Guillem
Index: lib/Locale/Po4a/Po.pm
===================================================================
--- lib/Locale/Po4a/Po.pm (revision 2764)
+++ lib/Locale/Po4a/Po.pm (working copy)
@@ -190,11 +190,11 @@
$self->{options}{$opt} = $options->{$opt};
}
}
- $self->{options}{'porefs'} =~ /^(full|counter|noline|none)(,(no)?wrap)?$/ ||
+ $self->{options}{'porefs'} =~ /^(full|counter|noline|file|none)(,(no)?wrap)?$/ ||
die wrap_mod("po4a::po",
dgettext ("po4a",
"Invalid value for option 'porefs' ('%s' is ".
- "not one of 'full', 'counter', 'noline' or 'none')"),
+ "not one of 'full', 'counter', 'noline', 'file' or 'none')"),
$self->{options}{'porefs'});
if ($self->{options}{'porefs'} =~ m/^counter/) {
$self->{counter} = {};
@@ -1275,6 +1275,8 @@
}
} elsif ($self->{options}{'porefs'} =~ m/^noline/) {
$reference =~ s/:\d+/:1/g;
+ } elsif ($self->{options}{'porefs'} =~ m/^file/) {
+ $reference =~ s/:\d+//g;
}
if (defined($self->{po}{$msgid})) {
Index: po4a
===================================================================
--- po4a (revision 2764)
+++ po4a (working copy)
@@ -686,6 +686,8 @@
$opts{"verbose"} = 0 if $opts{"quiet"};
$opts{"verbose"} ||= 1 if $opts{"debug"};
$opts{"msgmerge-opt"} .= " --previous" unless $noprevious;
+ $opts{"msgmerge-opt"} .= " --add-location=file"
+ if $opts{"porefs"} =~ m/^file/;
# options to transmit to the modules
$opts{"options"} = {