I setup the locales feature as directed, but it didn't work. I saw the same problem posted here , but was summarily categorized as "Not a bug. Won't Fix" with a reference to the archives and forum. That didn't help, so I did some debugging of my own. Here's what I got.




---
1. I started out by changing the language setting on the user information. Didn't work - still english.

2. I tried changing the english locales to see if the locales module was working. It works.

3. After some debugging, I found out the trouble was with the $locale global variable.


DETAILS:

In includes/common.inc, the $locale variable is set in this portion of the code.



// initialize localization system:

$locale = locale_init();

// initialize theme:

$theme = theme_init();

// initialize installed modules:

module_init();




However, when locale_init() is called by $locale, it seems that the $user variable has not yet been set, so it ends by by giving the default or 0 parameter in the $languages array, set in conf.php, which happens to be 'en'. So $locale is always 'en' or english.



I happened to notice that locale_init() is called a 2nd time by module_init(), but in this case, $user has been properly initialized and it now gives the proper language/locale setting.



4. I made a quick fix by moving the module_init() line before the $locale = ...line. It now works OK.



If there is a definite solution to this could you please direct me to the proper link and save me from more hours of searching


Thanks.


Info :
Sol8 on x86, PHP4.3.1, PostgreSQL7.3, Apache1.3.27, Drupal 4.1.0

Comments

ax’s picture

Priority: Major » Normal

this has been fixed in cvs, in both the 4.1.0 and HEAD branch. marking so.

al’s picture