On Sat, Jul 17, 2004 at 08:40:04PM +0200, Jordi Vilalta wrote:
Hello,
I've finally sent what I have from the Xml module. Don't expect too much
from it, it's in an initial state, with not much functionality. Currently
it can extract the tags contents, but the attributes are in the TODO list.
I hope you get the idea on how it works. There's a list of the tag types,
and there's a custom function (callbacks) for handling each tag type's
translation. Modifying this tag types list you and writing the custom
handling functions you can treat (I hope) each possible XML derivate
format (even some non-XML formats). The documentation should clear it a
little more.
Sounds interesting. Some comments:
- the wrap option must not be a module option, but should differ depending
on the tag. Proposition:
<abbrev>
W<acronym>
W<arg>
<artheader>
<attribution>
<date>
with 'w' meaning wrap (by default) and 'W' meaning don't wrap.
- the error messages should use dgettext to get translated. The reason why
it does not use gettext just as the scripts is that one day, maybe,
someone else than us will want to use the libraries (Po.pm, for example).
That day, we should search our translation in our own domain, not the one
of the guys using our code.
- you should die on error, not return an invalid string (get_structure())
- get_structure may be renamed get_path, no?
- don't comment the debuging statement, Use the debug option value to
determine whether to print them or not
- does get_string_until() really return the references (as the doc says)?
Wouldn't be easier to return the reference to the first/last line? It
depends on whether the module implementer may want to use only parts of it.
- s/toto/tutu/i is case insensitive. I dunno whether it help you, since I
didn't look closely enough to get where the tag detection is made, but
the 'i' char after the patern may be want you want.
I thought that XML *must* be case insensitive (wrt the tag names, at
least).
I attach an adaptation of the Dia module and a sample Docbook module
that
work both with the Xml module. The new Dia module is fully functional (I
like those really simple formats ;), but the Docbook one is only for
testing. At least those are examples of how simple the derived modules can
be.
If Dia2.pm is as good as Dia.pm. I guess that you should put it into the CVS
(erasing Dia.pm), and modify the MANIFEST to get Xml distributed. Xml
shouldn't be used directly, as you point out in the documentation, but
that's not an issue.
We may want to put the formats in another directory, maybe. So that
po4a-translate -t po blabla fails. For now, I guess that Chooser will try to
load Po.pm as a format...
Sorry, too sleepy to even glance the modules now...
Comments, patches, ideas, etc... are welcome.
Keep on the good work !
Thanks for your time, Mt.
--
Failure is not an option.
It comes bundled with software.