473,574 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7094
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_TI ME, $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_TI ME, $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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1813
by: Dariusz | last post by:
I am writing a guestbook script using MySQL, the part of the script below is a loop which executes to read from the database all the input data to print it out to screen. 1) In the $gbDate line, the $T argument displays as $T instead of the actual time in Windows. Is this a fault in Windows, or have I done something wrong? Webpage will...
5
8387
by: Gustaf Liljegren | last post by:
Trying to get a date in Swedish, but this won't work: $unix_time = strtotime($dt_created); setlocale(LC_TIME, 'sv', 'sve', 'swe', 'sv_SE'); $time = strftime('%A den %d %B', $unix_time); No matter what I put in setlocale(), I get English weekdays and months. I'm using PHP 4.3.8 on a UNIX computer, but I'm not in control of the...
3
3813
by: transam | last post by:
Hi, I use Mandrake linux 10 with German setup, Hungarian Keyboard. My Python is python 2.3.3. The following program fails: --------------------------------------------------------- import locale loc = locale.setlocale(locale.LC_ALL) # get current locale locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name
3
6721
by: Markus Ernst | last post by:
Hi In a multilanguage application I need the ucfirst() functionality. As this function is not multibyte-compatible I tried a function suggested in the manual: function my_mb_ucfirst($str) { $fc = mb_strtoupper(mb_substr($str, 0, 1)); return $fc.mb_substr($str, 1); }
0
1378
by: Paul Lautman | last post by:
Last night I had a web site. This morning it was returning nothing. I traced it to a call to setlocale(). It appears that something has happened that means that any call to setlocale completely kills the site, including dumping anything that is in the output buffer. Take a look at http://www.osg-uk.com/st.php and http://www.osg-uk.com/sts.php...
0
1502
by: jim | last post by:
Hello, I've got a problem with the setlocale function. This is my code (test.php) : ------------------ echo setlocale(LC_ALL, 'fr'); echo "<br />" ; echo bindtextdomain('fr-FR', './lang') ; echo "<br />" ;
7
2620
by: Steven Woody | last post by:
Hi, I am in Linux writing a program using setlocale(3). But I found, only the first invocation of setlocale(3) can be success, any subsequent calling of this function will fail ( return NULL ) and the locale is not changed. Is there any tip here? Thanks.
5
5707
by: yogeshmk | last post by:
I'm writing an application which is required to function with many languages and also compile on Linux & windows. Here's how I find the locale .. # include <stdio.h> # include <locale.h> int main(void) {
0
1490
by: bestbikeever | last post by:
from manual: 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...
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7760
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8271
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5335
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3774
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2273
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1099
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.