[wikka-community] Translations and XML

Masin Al-Dujaili masin_aldujaili
Tue Jun 16 08:10:36 GMT 2009


Hello Vincent,

Am Dienstag, den 16.06.2009, 09:21 +0200 schrieb Vincent Mayoux:
> > I would like to ask why you chose to store the translations in php files.
> > Why not XML ? It could be read, written and processed more easily than 
> > a php file.

I think, it's not. And that's mostly because in a PHP application you
can simply include the file with the language constants, while an XML
file needs to be parsed with a lot more of program logic.

> > An other argument is that you can't redefine a constant in Php, so if 
> > one need to customize some truncks of text to his site, he will have 
> > to modify the main translation file, and then lose his changes on the 
> > next update of Wikka. XML would allow to store the changes in a 
> > separated file.
> > Am I clear ?

And how exactly wouldn't you have to consider some extra logic if we'd
use XML files? Currently, with PHP constant definitions, you can use
either those or constant literals. If you'd have to deviate from those
strings in an XML file -- what would you do besides changing the
language pack or hard coding the string.

I guess, you think that the strings will stay in those PHP files
containing the program logic. That's wrong. Currently, all used strings
are 'collected' at the top as an intermediate step to out-source them to
distinct files, thus enabling language packs (probably the next release
(as has been told the last 4 releases ;-))). All you'd have to do is to
keep your own customized language pack. I am sure, there'll be a config
option to point to your language pack.

As for overwriting single strings, there might be some use indeed. But
I'd prefer PHP arrays instead of XML nonetheless.

Regards,
Masin






More information about the community mailing list