Connecting Tech Pros Worldwide Help | Site Map

Setlocale problem (PHP on Linux)

  #1  
Old December 23rd, 2005, 05:25 AM
Schraalhans Keukenmeester
Guest
 
Posts: n/a
Hi,

I run Apache 1.3.33 and PHP 5.0.4 on my Suse9.2 Linux box.
If I try any of the following:

setlocale (LC_TIME,'nl');
setlocale (LC_TIME,'nl_NL'); //example php.net site
setlocale (LC_TIME,'NL');
setlocale (LC_TIME,'Dutch');
setlocale (LC_TIME,'nl-NL');
etc.

nothing changes, and FALSE is returned.
When invoked with a NULL value, 'c' is returned.
In /usr/share/locale the dir for Dutch localization is called nl.

Any ideas anyoneon how to change locale to Dutch?
TIA

Sh.
  #2  
Old December 23rd, 2005, 02:55 PM
Janwillem Borleffs
Guest
 
Posts: n/a

re: Setlocale problem (PHP on Linux)


Schraalhans Keukenmeester wrote:[color=blue]
> I run Apache 1.3.33 and PHP 5.0.4 on my Suse9.2 Linux box.
> If I try any of the following:
>
> setlocale (LC_TIME,'nl');
> setlocale (LC_TIME,'nl_NL'); //example php.net site
> setlocale (LC_TIME,'NL');
> setlocale (LC_TIME,'Dutch');
> setlocale (LC_TIME,'nl-NL');
> etc.
>
> nothing changes, and FALSE is returned.
> When invoked with a NULL value, 'c' is returned.
> In /usr/share/locale the dir for Dutch localization is called nl.
>[/color]

Try the following script and check which locales return 1:

<?php

$locale = '/usr/share/locale';
$list = glob("$locale/*nl*");

foreach ($list as $item) {
$item = basename($item);
echo " $item : ", setlocale(LC_TIME, $item) ? 1 : 0, "\n";
}

?>


JW


  #3  
Old December 24th, 2005, 10:25 PM
Schraalhans Keukenmeester
Guest
 
Posts: n/a

re: Setlocale problem (PHP on Linux)


Janwillem Borleffs wrote:[color=blue]
> Schraalhans Keukenmeester wrote:
>[color=green]
>>I run Apache 1.3.33 and PHP 5.0.4 on my Suse9.2 Linux box.
>>If I try any of the following:
>>
>>setlocale (LC_TIME,'nl');
>>setlocale (LC_TIME,'nl_NL'); //example php.net site
>>setlocale (LC_TIME,'NL');
>>setlocale (LC_TIME,'Dutch');
>>setlocale (LC_TIME,'nl-NL');
>>etc.
>>
>>nothing changes, and FALSE is returned.
>>When invoked with a NULL value, 'c' is returned.
>>In /usr/share/locale the dir for Dutch localization is called nl.
>>[/color]
>
>
> Try the following script and check which locales return 1:
>
> <?php
>
> $locale = '/usr/share/locale';
> $list = glob("$locale/*nl*");
>
> foreach ($list as $item) {
> $item = basename($item);
> echo " $item : ", setlocale(LC_TIME, $item) ? 1 : 0, "\n";
> }
>
> ?>
>
>[/color]
I tried and got no results at all. Trying to glob other directories
returns unexpected results. Some dirs produce a full array with all the
files present in that directory, others produce nothing or -stranger-
only one item.

For instance, glob(/bin/*) only returns fortune, and so does
glob(/usr/share/*). All other files/dirs are not in the array. If I look
at ownership and rights, these have similar settings to all other
entries. Vague... Perhaps an Apache or php.ini setting? I am lost here.

I am gonna try all locale entries by hand I think, see which do yield a
positive result.

Thanks for your help JW!
Regards
Sh
  #4  
Old December 24th, 2005, 10:35 PM
Schraalhans Keukenmeester
Guest
 
Posts: n/a

re: Setlocale problem (PHP on Linux)


Schraalhans Keukenmeester wrote:[color=blue]
> Janwillem Borleffs wrote:
>[color=green]
>> Schraalhans Keukenmeester wrote:
>>[color=darkred]
>>> I run Apache 1.3.33 and PHP 5.0.4 on my Suse9.2 Linux box.
>>> If I try any of the following:
>>>
>>> setlocale (LC_TIME,'nl');
>>> setlocale (LC_TIME,'nl_NL'); //example php.net site
>>> setlocale (LC_TIME,'NL');
>>> setlocale (LC_TIME,'Dutch');
>>> setlocale (LC_TIME,'nl-NL');
>>> etc.
>>>
>>> nothing changes, and FALSE is returned.[/color][/color][/color]
[snip]
[color=blue]
> I am gonna try all locale entries by hand I think, see which do yield a
> positive result.
>
> Thanks for your help JW!
> Regards
> Sh[/color]
Update: none of the locales works. Must be a general issue setting thru
php locale or something. I'll keep looking.
Sh
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time GMT down nonce999 answers 3 April 2nd, 2008 04:45 PM
setlocale problem jim answers 0 February 1st, 2007 09:05 AM
locale and different encoding R answers 0 August 26th, 2006 03:25 PM
decimal symbol problem (using libxml2) corley answers 2 July 5th, 2006 09:05 PM