develooper Front page | perl.perl5.porters | Postings from July 2005

[RFC] Pod/ patch, for POD2::IT and other podstranslations

Enrico Sorcinelli
July 27, 2005 07:55
[RFC] Pod/ patch, for POD2::IT and other podstranslations
Message ID:
Hi all,

after almost two years from RFC, italian Perl users published (finally!) to
CPAN a large part of translated core Perl pods (including perlfunc and perlfaq*)
into the package POD2::IT where 'IT' is the language code. This has been (and
currently still is) a very big work! :-) 
(See for more details about the project)

Once the package has been installed, the translated documentation can be
accessed with: 

	%> perldoc POD2::IT::<podname>

However the -f and -q switches don't work no longer. 

So, I made a simple patch to Pod/ 3.14 (available at ) in order to allow also
the syntax: 

	%> perldoc -L IT <podname>
	%> perldoc -L IT -f <function>
	%> perldoc -L IT -q <FAQregex>

The patch adds the -L switch that allows to define language code for desired
language translation. If POD2::<code> package doesn't exists, the effect of the
switch will be ignored. 

Since Pod/'s search_perlfunc uses hard coded string 'Alphabetical
Listing of Perl Functions' to skip introduction, in order to make it to work
with other languages with the option -L, I used a simple plugin-like mechanism. 

POD2::<code> language package must export search_perlfunc_re that returns a
localized translation of the paragraph string above. This string will be used to
skip perlfunc.pod intro. Again, if POD2::<code>->search_perlfunc_re fails (or
doesn't exist), we'll come back to the default behavoiur. This mechanism allows
to add additional POD2::* translations without need to patch Pod/
every time. 

What do you think? 


	- Enrico

PS: I'm not shure if this is the right place to post these things (I've also
posted to perl-documentation list a few days ago without any reply), so sorry
for that :-) Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About