[geeklog-devel] Translation stuff for GL2
Tony Bibbs
tony at tonybibbs.com
Mon Jul 19 17:06:32 EDT 2004
Vinny,
Per your request I'm outlining what remains for for GL2's translation
engine. First a recap.
First, I wrote the translation engine from scratch mainly because the
one in PEAR didn't, at the time, make upgrading to new releases easy on
translators. Basically, with each new release, as with 1.3.x, the
translators have to manually update the new file OR hack a way to merge
them. It is probably worth looking at what is in PEAR again to see if
merging of translation files is supported. If it is, I could be
compelled to simply use it.
However, assuming it still doesn't work that way here is what I have done:
1) The combination of getstrings and StringExtractor.class.php currently
work in PHP5 and parse anything of the form "->translate('[some
string]')" OR "->translate('[some other string]', '[some section name]]);
2) The data is collected in an array and is outputted to an xml file
with the following basic structure
<application name="" version="">
<translator name="" email=""/>
<translation language="">
<section name="">
<entry>
<string_id></string_id>
<string></string>
</entry>
</section>
</translation>
A couple of notes about the format. the section and entry tags can
repeat. Also, the string_id is the native language string and the
string tag is the translated version
Here is what is left:
1) The big issue to iron out is how to incorporate plugins. My original
thought was that plugins would each have their own XML file and would
not share the main Geeklog
file but given our plugin-centric approach this may not make sense
anymore. We may want to consider inserting <plugin> tags around the
section tags. Just a though, regardless
this probably needs some talking outload. Dirk, any suggestions
here since you are a big user of the translation stuff?
2) mergeversions needs to be ported to PHP5 and should honor the new
section tags. Furthermore, it should be written to use the new PHP5 XML
features
3) We should add optional support of storing the strings in a database.
To that end, we should add the ability to import the xml files into a
database table. Not sure of the best way to do this as there are a few
options.
4) similarly Translator.class.php should be ported to PHP5 and use the
new PHP5 XML parsing features
5) Build an xml schema we can use in mergeversions and in getstrings to
validate the XML of the translation file. PHP5 has a built in XML
validator to help do most of this work.
6) As mentioned, look at StringExtractor.class.php for performance
improvements.
7) We should look into PEAR::Cache and how it might make the translation
process faster. You might want to ask JellyBob (Jon Wood) how
PEAR::Cache works exactly...while he hasn't committed any time to GL2
persay, I'm sure he'd be willing to explain it abit.
Anything else?
--Tony
More information about the geeklog-devel
mailing list