As requested by Robert I am going to sketch which changes would be required
to make FOSSology i18N compliant:

The translated text is _not_ stored in the original PHP-source files.
Rather, all translatable strings are marked for processing with gettext:

Thus the file:

<?php
echo 'hello world';
?>

Is patched to

<?php
require_once('i18n.php');
echo _('hello world');
?>

The _() is a function used by the gettext-library. Then the translatable
strings are extracted and stored in a separate file (po-file).
In the po-file, which is setup for each supported language, the translated
strings are added.

# this is messages.po in locale/de_DE/LC_MESSAGES

msgid "hello world"

msgstr "hallo welt"

For performance reasons, this file is converted into a binary form
(mo-file), and stored in locale/de_DE/LC_MESSAGES
or similar.
When the php-file is now requested, there is a tiny php-script - which is
added by inserting it plainly or
by using 'required_once', to identify the wanted locale-setting.

The lines to be added contain the gettext-specifics
// this is i18n.php
[some code to determine locale and encoding]
setlocale(LC_MESSAGES, $locale);
bindtextdomain($domain, './locale');
bind_textdomain_codeset($domain, $encoding);
textdomain($domain);
// end

You can browse the web for details using the keywords
gettext php

A merry christmas to all of you.
Yours Stefan Schroeder
_______________________________________________
fossology mailing list
[email protected]
http://fossology.org/mailman/listinfo/fossology

Reply via email to