Improving Drupal performance using native gettext for translations
Hi, I'd like to know if anyone has ever experimented with making Drupal use the php gettext extension to retrieve the string translations from a binary gettext file (.mo)? We have recently made a patch that allows Drupal to do this. We published a blog post about it last week. The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po". When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file. It improves performance even in a clean Drupal install. Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability. This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal. Could this patch be proposed for D8, D7, D6, Pressflow? -- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
Hi, Where have you posted the patch? Gábor On Mon, Jun 13, 2011 at 4:37 PM, Pedro Lozano <peterlozano@gmail.com> wrote:
Hi, I'd like to know if anyone has ever experimented with making Drupal use the php gettext extension to retrieve the string translations from a binary gettext file (.mo)? We have recently made a patch that allows Drupal to do this. We published a blog post about it last week. The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po". When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file. It improves performance even in a clean Drupal install. Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability. This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal. Could this patch be proposed for D8, D7, D6, Pressflow?
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
Sorry, Reference: * http://al.quimia.net/en/blog/improving-drupal-performance-using-native-gette... On Mon, Jun 13, 2011 at 16:39, Gábor Hojtsy <gabor@hojtsy.hu> wrote:
Hi,
Where have you posted the patch?
Gábor
On Mon, Jun 13, 2011 at 4:37 PM, Pedro Lozano <peterlozano@gmail.com> wrote:
Hi, I'd like to know if anyone has ever experimented with making Drupal use the php gettext extension to retrieve the string translations from a binary gettext file (.mo)? We have recently made a patch that allows Drupal to do this. We published a blog post about it last week. The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po". When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file. It improves performance even in a clean Drupal install. Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability. This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal. Could this patch be proposed for D8, D7, D6, Pressflow?
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com | +34 667836318 pedro@al.quimia.net | http://al.quimia.net | +34 956396515
Hi Pedro, The way to get improvements to Drupal core is to post your suggestion for improvement on the drupal.org issue queue. It is not like that Drupal core maintainers pick improvements from blogs of different people :) Please post your patch with a summary of your performance findings and pros/cons so it can be discussed on drupal.org. Let us know about the link to your drupal.org issue. Thanks for your work, Gábor On Mon, Jun 13, 2011 at 4:45 PM, Pedro Lozano <pedro@al.quimia.net> wrote:
Sorry, Reference: * http://al.quimia.net/en/blog/improving-drupal-performance-using-native-gette...
On Mon, Jun 13, 2011 at 16:39, Gábor Hojtsy <gabor@hojtsy.hu> wrote:
Hi,
Where have you posted the patch?
Gábor
On Mon, Jun 13, 2011 at 4:37 PM, Pedro Lozano <peterlozano@gmail.com> wrote:
Hi, I'd like to know if anyone has ever experimented with making Drupal use the php gettext extension to retrieve the string translations from a binary gettext file (.mo)? We have recently made a patch that allows Drupal to do this. We published a blog post about it last week. The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po". When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file. It improves performance even in a clean Drupal install. Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability. This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal. Could this patch be proposed for D8, D7, D6, Pressflow?
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com | +34 667836318 pedro@al.quimia.net | http://al.quimia.net | +34 956396515
Thanks Gábor, I already submitted the patch yesrterday. http://drupal.org/node/1187084 Bests, On Tue, Jun 14, 2011 at 08:36, Gábor Hojtsy <gabor@hojtsy.hu> wrote:
Hi Pedro,
The way to get improvements to Drupal core is to post your suggestion for improvement on the drupal.org issue queue. It is not like that Drupal core maintainers pick improvements from blogs of different people :) Please post your patch with a summary of your performance findings and pros/cons so it can be discussed on drupal.org. Let us know about the link to your drupal.org issue.
Thanks for your work, Gábor
On Mon, Jun 13, 2011 at 4:45 PM, Pedro Lozano <pedro@al.quimia.net> wrote:
Sorry, Reference: * http://al.quimia.net/en/blog/improving-drupal-performance-using-native-gette...
On Mon, Jun 13, 2011 at 16:39, Gábor Hojtsy <gabor@hojtsy.hu> wrote:
Hi,
Where have you posted the patch?
Gábor
On Mon, Jun 13, 2011 at 4:37 PM, Pedro Lozano <peterlozano@gmail.com> wrote:
Hi, I'd like to know if anyone has ever experimented with making Drupal
use
the php gettext extension to retrieve the string translations from a binary gettext file (.mo)? We have recently made a patch that allows Drupal to do this. We published a blog post about it last week. The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po". When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file. It improves performance even in a clean Drupal install. Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability. This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal. Could this patch be proposed for D8, D7, D6, Pressflow?
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com | +34 667836318 pedro@al.quimia.net | http://al.quimia.net | +34 956396515
-- Pedro Lozano peterlozano@gmail.com | http://peterlozano.com pedro@al.quimia.net | http://al.quimia.net +34 ( 667836318 | 956396515 )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 13.06.2011 16:37, schrieb Pedro Lozano:
Hi,
I'd like to know if anyone has ever experimented with making Drupal use the php gettext extension to retrieve the string translations from a binary gettext file (.mo)?
I did experiment with it. Probably 7 years ago or so. :p
We have recently made a patch that allows Drupal to do this. We published a blog post about it last week.
The pre-compile gettext file is created with "msgfmt -o messages.mo drupal-es.po".
When you place it at sites/whatever/locale/es/LC_MESSAGES/messages.mo, Drupal detects it and uses the gettext function to retrieve the translations from the file.
It improves performance even in a clean Drupal install.
Of course you loose the flexibility of the string translating interface but for sites with little changes to the translations and where performance is key this helps with hardware resources and scalability.
This week we will be at Barcelona Drupal Days and for the code sprint we've planned to make some kind of interface that allows you to generate the .mo file directly from Drupal.
Could this patch be proposed for D8, D7, D6, Pressflow?
D6/7 are clearly our since it would be a new feature. Ideally, you'd make a path so that this could become a contrib module. The gettext extension is non-standard as are the gettext tools themselves. Cheers, Gerhard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk32JIwACgkQfg6TFvELooQ6lgCeIT+Quydxh8binGbdMJJA5wsx 4loAoMe4/BcYfPa9VZxNRlHO+0ZyRhj3 =WIqQ -----END PGP SIGNATURE-----
participants (4)
-
Gerhard Killesreiter -
Gábor Hojtsy -
Pedro Lozano -
Pedro Lozano