[Mapbender-dev] Re: LC_MESSAGES and Windows (again)

Christoph Baudson christoph.baudson at wheregroup.com
Fri Mar 6 05:20:10 EST 2009


Thanks for your input, Thomas. We should definitely have a workaround. I 
have googled some more, and didn't find any solution to this (but a lot 
of people having the same trouble).

I think the easiest solution might be replacing line 27 in 
core/globalSettings.php by

if (!defined('LC_MESSAGES')) define('LC_MESSAGES', LC_CTYPE);

Thomas, could you try if this has the same effect as your workaround?

BTW, re-reading PHP.net's page for setlocale has a discouraging warning:

"The locale information is maintained per process, not per thread. If 
you are running PHP on a multithreaded server api like IIS or Apache on 
Windows you may experience sudden changes of locale settings while a 
script is running although the script itself never called *setlocale()* 
itself. This happens due to other scripts running in different threads 
of the same process at the same time changing the processwide locale 
using *setlocale()*."

So using gettext in Windows with PHP is not really recommended.

Christoph



Thomas Baschetti schrieb:
> Christoph Baudson schrieb:
>> Thomas Baschetti schrieb:
>>> OK, no PHP-Error, but still language support under windows seems to 
>>> fail:
>>>
>>> $selectedLocale = setlocale(LC_MESSAGES, $locale);
>>> $e = new Mb_notice("setlocal fuer LC_MESSAGES " . LC_MESSAGES . " 
>>> auf locale: >" . $selectedLocale . "<");
>>>
>>> results in
>>> Notice: setlocal fuer LC_MESSAGES 6 auf locale: ><
> [...]
>>>
>>> Can anyone confirm this?
>>
>> Yes, I've experience the same problem...but no solution yet. Where 
>> are the Windows gurus?
>>
>> I will re-open the ticket.
>
> if i see it correctly, we are using lc_messages mainly for _determing_ 
> the right language, right?
> So why not just use e.g. LC_CTYPE?
> Or something like:
>
> if (defined('LC_MESSAGES')){
>     $selectedLocale = setlocale(LC_MESSAGES, $locale);
> }
> else{
>     $saveme=setlocale(LC_CTYPE,0);
>     $selectedLocale=setlocale(LC_CTYPE,$locale);
>     $saveme=setlocale(LC_CTYPE,$saveme);
> }
>
> if we must preserve LC_CTYPE.
>
> Ciao
> Thomas
> _______________________________________________
> Mapbender_dev mailing list
> Mapbender_dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_dev


-- 

----------------------------------

 FOSSGIS Konferenz 2009
 17.-19. März 2009 in Hannover
 http://www.fossgis.de/konferenz

---------------------------------- 

_______________________________________

W h e r e G r o u p GmbH & Co. KG

Siemensstraße 8
53121 Bonn
Germany

Christoph Baudson
Anwendungsentwickler

Fon: +49 (0)228 / 90 90 38 - 15
Fax: +49 (0)228 / 90 90 38 - 11
christoph.baudson at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
_______________________________________

Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
_______________________________________



More information about the Mapbender_dev mailing list