[Koha-patches] [PATCH] Bug 5506 Shorten .po file comment lines

Frédéric Demians f.demians at tamil.fr
Tue Dec 21 21:42:41 CET 2010


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]
---
 misc/translator/xgettext.pl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/misc/translator/xgettext.pl b/misc/translator/xgettext.pl
index 031f9ba..abe315e 100755
--- a/misc/translator/xgettext.pl
+++ b/misc/translator/xgettext.pl
@@ -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;
-- 
1.7.3.2



More information about the Koha-patches mailing list