Re: Re: gettext best practices?
Hy Michael,
> It would appear that the gettext translation module parses the entire
> .mo file into itself and uses that information to perform the
> translations.
That's right
> It's actually compiled into a PHP Array so.
Compiled is a little bit oversized word for this but ok.
> 1) The best practice would be to break your translation into a large
> number of modules (if performance is your main non-functional
> requirement but not if it's getting easy translations done!)
This increases overhead for Zend_Translate and for maintenance.
This also increases the workflow for translators.
For a normal application is performance with Zend_Translate not your problem
if your application is slow...
If you have about 5000 or more translations I recommend to split the
translation source.
But this is not because Zend_Translate is then slow, this is because of
restrictments of PHP itself.
> 2) gettext is a more expensive version of using the arrays backend.
No... it's a less expensive version. What takes time is reading the original
source. Your processor is always faster than your harddrive.
It is better to do some computations than reading a bigger file. And mo
files are much smaller than the same sized array files.
> So I'm going to be changing my approach and scrapping the gettext api
> in favour of PHP arrays and writing a tool for translators to use to
> ensure I get valid PHP arrays back from them.
If you are writing such a tool and make it avaiable for free, I think also
others would have need of this.
The array source is best when you are playing around and want to self edit
the source.
Greetings
Thomas (Zend_Translate's author)
I18N Team Leader