Translations: I can hear the complaints already
| From: | Tony Bibbs | Date: | Tue, 15 Apr 2003 21:14:14 +0000 |
| Subject: | Translations: I can hear the complaints already | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-15190@lists.php.net to get a copy of this message | ||
I'll preface this with two items:
1) I know Wojciech's Translation package exists. I even started down the
path of working with him until deadlines started cropping up.
2) I know how much some of you hate to see packages tackling the same
problems (e.g. HTML templates)
That said, I wanted to send out feelers before I actually proposed this
package. What is it? Well, if you haven't already figured it out it is
yet another translation package. Unlike Wojciech's package, mine is
completely XML-based and requires no additional PEAR packages. Here is a
quick run down of features:
1) The translator object has a translate() method. This method takes a
string in the language primarly being targeted. That's right, not
necessarily English. I will refer the primary langauge for the app as the
native language.
2) all translations live in an XML file with a well defined schema:
<APPLICATION name="myApp" version="1.0">
<TRANSLATOR name="Your Name" email="you@example.com" />
<TRANSLATION language="en">
<ENTRY>
<STRING_ID>Some english text</STRING_ID>
<STRING></STRING>
</ENTRY>
<ENTRY>
<STRING_ID>Some more english text</STRING_ID>
<STRING></STRING>
</ENTRY>
</TRANSLATION>
3) All translation XML files except for the native language is used. When
using the native language, the translator object is smart enough to
returned the given string instead of doing any file I/O
4) Similar to xgettext, a PHP script called getstrings will parse all code
files to build the native language XML file. This file is the one you
would give to your translators. Translators would add their translations
to the <STRING> tags.
5) For incremental updates, another PHP script called mergeversions allows
translators to merge an older, translated file with the new native
langauge file. The script prints out all the new strings that were added
for faster translation time.
Beta code is here:
http://cvs.geeklog.net/chora/cvs.php/Translator
So the question I have, naturally, is given there is already a package and
that duplication isn't always in the best interested what do you want me
to do with this thing? Oh, and if Wojciech can somehow incorporate what I
have that would be fine. The only thing I would note about what I have
that I like I really like not having other PEAR dependencies (e.g.
PEAR::DB).
--
Tony Bibbs "I guess you have to remember that those who don't
tony@tonybibbs.com hunt or fish often see those of us who do as
harmlessly strange and sort of amusing. When you
think about it, that might be a fair assessment."
--Unknown