develooper Front page | perl.perl5.porters | Postings from December 2011

Translating the perl core pod/* with po4a

Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
December 5, 2011 15:44
Subject:
Translating the perl core pod/* with po4a
Message ID:
CACBZZX4JmyXvyhbV=Qo9va1qkNvB8L3mOjW6PQC1kKcEV8sLrg@mail.gmail.com
As a proof of concept during a discussion on #p5p I split up and made
one of perl's pod documentation files translatable with po4a[1].

po4a basically splits up documentation into a PO file, the PO file can
then be incrementally translated into different languages, and using
the normal PO facilities sections will be marked as out of date
(needing re-translations), missing etc.

So what it does is turn something like this (extract from
perlootut.pod):

    =head1 NAME

    perlootut - Object-Oriented Programming in Perl Tutorial

    =head1 DESCRIPTION

    This document provides an introduction to object-oriented programming
    in Perl. It begins with a brief overview of the concepts behind object
    oriented design. Then it introduces several different OO systems from
    L<CPAN|http://search.cpan.org> which build on top of what Perl
    provides.

    By default, Perl's built-in OO system is very minimal, leaving you to
    do most of the work. This minimalism made a lot of sense in 1994, but
    in the years since Perl 5.0 we've seen a number of common patterns
    emerge in Perl OO. Fortunately, Perl's flexibility has allowed a rich
    ecosystem of Perl OO systems to flourish.

Into a perlootut.pot file:

    #. type: textblock
    #: perlootut.pod:9
    msgid "perlootut - Object-Oriented Programming in Perl Tutorial"
    msgstr ""

    #. type: =head1
    #: perlootut.pod:15
    msgid "DESCRIPTION"
    msgstr ""

    #. type: textblock
    #: perlootut.pod:17
    msgid ""
    "This document provides an introduction to object-oriented programming in "
    "Perl. It begins with a brief overview of the concepts behind
object oriented "
    "design. Then it introduces several different OO systems from "
    "L<CPAN|http://search.cpan.org> which build on top of what Perl provides."
    msgstr ""

    #. type: textblock
    #: perlootut.pod:23
    msgid ""
    "By default, Perl's built-in OO system is very minimal, leaving you to do "
    "most of the work. This minimalism made a lot of sense in 1994, but in the "
    "years since Perl 5.0 we've seen a number of common patterns
emerge in Perl "
    "OO. Fortunately, Perl's flexibility has allowed a rich ecosystem
of Perl OO "
    "systems to flourish."
    msgstr ""

Which can then be translated as multiple perlootut.$lang.po
files. These PO files can then be used to re-assemble a verion of
perlootut in another language.

It would be relatively easy to:

 * Maintain PO files for translated documentation either in the
   core. We wouldn't have to ship po4a since it would be a
   maintainer-only tool.

 * Just check in the generated perlootut_$lang.pod files somewhere
   once they're translated, and worry about something smarter once we
   have a lot of them.

 * Generate them as usual without any extra software (except more
   makefile rules) during the build process.

 * Make "perldoc" support "--lang" (or read it from the environment),
   so "perldoc --lang=it perlootut" would implicitly open e.g.
   perlootut::it.

Currently we have the POD2 namespace on CPAN with some translated core
documentation (including French, Italian and Spanish), but this has
fairly low visibility is all manually maintained as one-off
translations, and isn't installed along with perl itself.

Would there be any interest in having something like this in the core?
I'm currently pushing through a big translation patch into git.git and
this is something I could perhaps dabble in too.

I'm CC-ing the maintainers of the POD2 modules I could find to see if
this is something they'd be interested in.

1. http://po4a.alioth.debian.org/features.php

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About