[Typo3-dev] gettext as default translation system

Sven Wilhelm wilhelm at icecrash.com
Wed Nov 23 19:40:08 CET 2005


Hi

> Can you also make an estimation whether the speed gain is worth the effort
> or not?
I cannot give you a percentage of performance boost. Fact is that 
gettext is available as native extensions to PHP. So all work is done 
native. The translations are splittet across a file for one language 
(should also reduce memory consumption).

Bad situation exists when there is no GetText available as extension, 
then for all parts the interpreter is used.

So calculation is: If present, more native use of PHP, if not, same 
situation as present, at least less memory consumption.

Whats to do for migrating to GetText?
As a general overview:
http://www.php.net/manual/de/ref.gettext.php

 From the short help:
<?php
// Current locale settings
$locale=setlocale (LC_ALL, $language);
$domain = 'messages';
bindtextdomain($domain, "./locale");
textdomain($domain);
$result = gettext("The string must be here\n");
?>

Ok, splittet in several parts across the system :)

Organisation in the extensions root:
-> Add dir locale/
And for each used locale a folder like de_DE
(locale/de_DE/LC_MESSAGES/???)

Imaging you want to use placeholders in the localized strings!
$result = sprintf(gettext("Hello user %s. How are you?"), $user);

Did I answer your question?

Kind regards

Sven




More information about the TYPO3-dev mailing list