Bug 5506 Shorten .po file comment lines
authorFrédéric Demians <f.demians@tamil.fr>
Tue, 21 Dec 2010 20:42:41 +0000 (21:42 +0100)
committerChris Nighswonger <chris.nighswonger@gmail.com>
Tue, 21 Dec 2010 22:02:37 +0000 (17:02 -0500)
In opac/staff templates .po files, we have comment lines contextualizing
extracted text in templates. Path to template are absolute. For example, we can
have:

  #: /home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/...
     modules/cataloguing/addbiblio.tmpl:585

The first part of the pathname is useless. With this patch, we just keep
relative path to tempalte from Koha template main directory. The above example
becomes:

  #: intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl:585

To be applied on [3.2]

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit f460afbad6566e68bdbaddb5577f13f77a86a877)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
misc/translator/xgettext.pl

index 031f9ba..abe315e 100755 (executable)
@@ -212,6 +212,7 @@ EOF
        for my $token (@{$text{$t}}) {
            my $pathname = $token->pathname;
            $pathname =~ s/^$directory_re//os;
+        $pathname =~ s/^.*\/koha-tmpl\/(.*)$/$1/;
            printf OUTPUT "#: %s:%d\n", $pathname, $token->line_number
                    if defined $pathname && defined $token->line_number;
            $cformat_p = 1 if $token->type == TmplTokenType::TEXT_PARAMETRIZED;