Re: setlocale on OS X not working

From: Date: Thu, 27 Dec 2001 16:29:43 +0000
Subject: Re: setlocale on OS X not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-78852@lists.php.net to get a copy of this message
Thanks for your help, but it doesn't work either :-( Am Donnerstag den, 27. Dezember 2001, um 16:12, schrieb Brian Clark:
* Stefan Rusterholz (lists@brightlight.ch) [Dec 27. 2001 09:13]:
Hi
Hiya
I'm using following code:
setlocale(LC_ALL, 'german'); $timestamp = time(); $string = strftime('Heute ist %A, der %d. %B %Y. Sie haben diese Seite um %H Uhr %M aufgerufen.', $timestamp); # in english: "today it's %A, the %d. %B. %Y. You opened this page at %H:%M." echo "$string";
Which works nice on my ISP's Server. On my locale OS X Server it seems like it wouldn't be able to translate it. I get the correct output but in english instead of german.
The OSX machine doesn't have a definition for `german' but it probably has one for en_US, for example. Try de or de_DE or de_DE.ISO8859-1 instead of `german' and see if you get what you'd expect. FYI, I've never used OSX, so I'm flying blind.
AFAIR I need to have some files to be installed on my system for that function to work correct. Does someone know where to get those files and where to put them in my system?
On my system, charmaps in /usr/share/i18n/locales and definitions in /usr/lib/locale, and I would use localedef to build definitions from the charmaps (I think. I might have those directories reversed.). I've never used (or seen) OSX, but does it use man? (I'm absolutely not being a smarta$$ here). If it has man, look at the man pages for localedef' and locale' and that may get you headed in the right direction.
I did that. For localedef it hasn't an entry. But for locale it has one. I don't think that's what you expectet (it seems to belong to perl)
locale(3)        Perl Programmers Reference Guide       locale(3)
NAME
       locale - Perl pragma to use and avoid POSIX locales for
       built-in operations
SYNOPSIS
           @x = sort @y;       # ASCII sorting order
           {
               use locale;
               @x = sort @y;   # Locale-defined sorting order
           }
           @x = sort @y;       # ASCII sorting order again
DESCRIPTION
       This pragma tells the compiler to enable (or disable) the
       use of POSIX locales for built-in operations (LC_CTYPE for
       regular expressions, and LC_COLLATE for string compari-
       son).  Each "use locale" or "no locale" affects statements
       to the end of the enclosing BLOCK.
       See the perllocale manpage for more detailed information
       on how Perl supports locales.
2000-03-30                 perl v5.6.0
Perhaps this information helps you to help me further: Mac OS X is based on FreeBSD 3.0 (AFAIR).

« previous php.general (#78852) next »