I am still tying to setup phpesp 1.6.1 in OS/2 (yes, it is working, but
still having problems with gettext). Being quite a PHP dumb, I have
troubles understanding the following few lines of code in espi18n.inc
=============================
foreach ($_langs as $_lang) {
[snip]
if (isset($_locales[$_lang])) {
$lang = $_lang;
[etc]
=============================
This is in the esp_setlocale_ex() funtion, and it is where the language
would be set according to the browser preferences.
$_langs is a string array of languages accepted by the browser, in the form:
$_langs[1]= en_US
$_langs[2]= en
$_langs[3]= it
etc
so $_lang is a string assuming each of those values in turn.
$_locales is also an array of strings, containing all the languages
supported by phpesp(contained in the \locale directory). So it has the form:
$_locales[1]= da_DK
$_locales[2]= de_DE
$_locales[3]= en_US
etc...
So, what $_locales[$_lamg] would mean?
Wouldn't the array $_locales expect an integer as the index, rather than
a string like $_lang?
Accordingly, im my experiments the expression (isset($_locales[$_lang]))
never get true, even if the requested language (contained in $_lang) is
actually supported and present in $_locales. Thus, $lang remains empty,
and the language is always set to the default set in phpesp.ini.php.
What am I missing?
What is that code actually doing?
thanks,
Piersante
|