471,571 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,571 software developers and data experts.

Setlocale problem (PHP on Linux)

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.
Dec 23 '05 #1
3 6981
Schraalhans Keukenmeester wrote:
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.


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
Dec 23 '05 #2
Janwillem Borleffs wrote:
Schraalhans Keukenmeester wrote:
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.

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";
}

?>

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
Dec 24 '05 #3
Schraalhans Keukenmeester wrote:
Janwillem Borleffs wrote:
Schraalhans Keukenmeester wrote:
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.
[snip]
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

Update: none of the locales works. Must be a general issue setting thru
php locale or something. I'll keep looking.
Sh
Dec 24 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dariusz | last post: by
5 posts views Thread by Gustaf Liljegren | last post: by
3 posts views Thread by transam | last post: by
3 posts views Thread by Markus Ernst | last post: by
reply views Thread by Paul Lautman | last post: by
reply views Thread by jim | last post: by
7 posts views Thread by Steven Woody | last post: by
5 posts views Thread by yogeshmk | last post: by
reply views Thread by bestbikeever | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.