[Po4a-devel][RFCs] configuration file format (+ addendum change?)

martin.quinson@free.fr martin.quinson@free.fr
Wed, 30 Jun 2004 23:38:12 -0700


Hello,

now that po4a is rather stable and reliable (thanks to the test suite), m=
y=20
feeling is that the main showstopper preventing po4a from being widly use=
d is=20
the way to use it. It's far too complicated, with 2 tools to use at each=20
update, each of them requiring 3 or more options. My goal (beside becomin=
g=20
imortal/worldmaster/whatever) would be to solve that situation.=20

I would like to come up with a design of configuration file which would a=
llow=20
people to do the two most often used actions (po4a-updatepo & po4a-transl=
ate)=20
in one shoot as simple as "po4a -c configuration_file".

The chalenge here is to not report the complexity into the config file, b=
ut=20
come up with a simple design.

I'm thinking about that since a long time, and I'm still unsure about how=
 to=20
achieve it. For each master file (ie, file to be translated), we have to=20
express its format, and the corresponding localized files. If possible, I=
=20
would like it to be analog with the format used in po-debconf and the gno=
me=20
l10n tools.

The following may do the trick:
[<format>] <master_file> <lang>:<localized_file>+

We also need to express where the translation files are (pot+po). In orde=
r to=20
not break the compatibility, the pseudo-format "po4a/paths" could be=20
introduced.

For example,
[po4a/paths] doc/l10n/project.doc.pot fr:doc/l10n/fr.po de:doc/l10n/de.po
[sgml] doc/my_stuff.sgml fr:doc/fr/mon_truc.sgml de:doc/de/mein_cram.sgml
[pod] script fr:doc/fr/script.1 de:doc/de/script.1

Then, the po4a tool would create a potfile by aggregating the parsed cont=
ent=20
of all master files, updating all po files against that file, and then=20
generate each localized files from each of them.


I guess it would do the trick, but there at least one limitation: we cann=
ot=20
add addendums in that way. Anyway, the addendums are not very practical r=
ight=20
now, and we may want to change them. One good thing would be to embeed th=
em=20
into the po file. Having only one file containing all input from translat=
or=20
would ease the interactions with the developers.

It could be done by dealing specifically with msgids named something=20
like "po4a-addendum:<filename>:<addendum_count>". In that case, the=20
translation of this msgid would be an addendum against this file. The hea=
der=20
could be placed into the msgid, also.

Another possible limitation is that all this relies on the fact that the=20
programes with which I aim at being compatible are smart enough to ignore=
 the=20
lines for format they don't know about. I didn't check this out. Denis?
If not, it may be a bit artificial.

Yet another limitation is that I have no idea about how to handle module=20
options...


Once we come up with a configuration file design, doing the actual script=
=20
should be rather easy (even if TransTractor also have to be modified to e=
xport=20
some more functions):
parse_config($cfg_file);

# make a big pot
my $potfile=3DLocale::Po4a::Po->new();
foreach ($format,$master) {
 my $doc=3DLocale::Po4a::Chooser::new($format);
 $doc->setpoout($potfile);    # trivial function to write, check getpoout
 $doc->process('file_in_name' =3D> $master);
 $potfile =3D $doc->getpoout(); # private function to export
}
$potfile->writefile($potfile_name);

# update all po files, just like in po4a-updatepo

# update all translations
foreach ($format,$master,$localized) {
 my $doc=3DLocale::Po4a::Chooser::new($format);
 $doc->setpoin($potfile);
 $doc->process('file_in_name' =3D> $master,
               'file_out_name' =3D> $localized);
}

I didn't test this _at all_, since my hard disk didn't came back to life =
yet=20
(tomorow, hopefully). I'm still under webmail, under windows (erk)...


So. What do you guys think about that? Isn't that neat?
Mt.