Docs for page Translation.php

Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/php/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 370

## /Translation.php

Description
Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/php/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 370

Functions involved in translating with gettext

- author: Andrew McMillan <andrew@mcmillan.net.nz>
- copyright: Catalyst IT Ltd
- license: GNU GPL v2 or later

Functions
Strict Standards: Only variables should be passed by reference in /usr/share/php/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 712 Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/php/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 370
awl_set_locale (line 99)

Set the translation to the user's locale. At this stage all we do is call the gettext function.

void awl_set_locale ( $locale)

- $locale

i18n (line 54)

Mark a string as being internationalized. This is a semaphore method; it does nothing but it allows us to easily identify strings that require translation. Generally this is used to mark strings that will be stored in the database (like descriptions of permissions).

AWL uses GNU gettext for internationalization (i18n) and localization (l10n) of text presented to the user. Gettext needs to know about all places involving strings, that must be translated. Mark any place, where localization at runtime shall take place by using the function translate().

In the help I have used 'xlate' rather than 'translate' and 'x18n' rather than 'i18n' so that the tools skip this particular file for translation :-)

E.g. instead of: print 'TEST to be displayed in different languages'; use: print xlate('TEST to be displayed in different languages'); and you are all set for pure literals. The translation teams will receive that literal string as a job to translate and will translate it (when the message is clear enough). At runtime the message is then localized when printed. The input string can contain a hint to assist translators: print xlate('TT <!-- abbreviation for Translation Test -->'); The hint portion of the string will not be printed.

But consider this case: $message_to_be_localized = 'TEST to be displayed in different languages'; print xlate($message_to_be_localized);

The translate() function is called in the right place for runtime handling, but there is no message at gettext preprocessing time to be given to the translation teams, just a variable name. Translation of the variable name would break the code! So all places potentially feeding this variable have to be marked to be given to translation teams, but not translated at runtime!

This method resolves all such cases. Simply mark the candidates: $message_to_be_localized = x18n('TEST to be displayed in different languages'); print xlate($message_to_be_localized);

- return: the same value

string i18n (string $value)

- string $value: the value

init_gettext (line 84)

Initialise our use of Gettext

void init_gettext ( $domain, $location)

- $domain
- $location

translate (line 65)

Convert a string in English to whatever this user's locale is

void translate ( $en)

- $en

Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/php/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 370

Documentation generated on Wed, 04 Jul 2012 07:06:16 +0000 by phpDocumentor 1.4.3