[Koha-devel] Perl / regexp question

paul POULAIN paul.poulain at free.fr
Mon Jan 12 22:13:04 CET 2004


Hi,

In the translator tool, we have a little problem.
We have the following strings in templates : <a 
href="/koha/search.pl">search</a> the library.

In the translation file for french, we have :
search    chercher
So, the regexp :
$line =~ s/(\W)$text(\W)/$1$subst$2/g;

gives : <a href="/koha/chercher.pl">chercher</a> dans la bibliothèque.

that is WRONG !!! (search.pl must not be replaced !)

& I couldn't find the regexp that could work better.
I tried to use HTML::Tree, HTML::TreeBuilder, but without success : it 
doesn't enjoy HTML::Template syntaxt & create bad HTML :-(
I also tried to play with HTML::Parser, but without success neither.

For instance, the workaround is NOT to replace strings translated by 
IGNORE, but that's really a poor way to do it, as some things are no 
more translated.

but i'm still looking for a better solution to do this.

Note : remembre we can also have <img src="XX" alt="search"> and this 
search is to be replaced...

-- 
Paul POULAIN
Consultant indépendant en logiciels libres
responsable francophone de koha (SIGB libre http://www.koha-fr.org)






More information about the Koha-devel mailing list