Re: setlocale Q

From: Date: Thu, 23 Oct 2003 08:21:00 +0000
Subject: Re: setlocale Q
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-167239@lists.php.net to get a copy of this message
jsWalter wrote:
setlocale(LC_TIME, "de_GR"); gives me 'October'? setlocale(LC_TIME, "de"); gives me 'October'? setlocale(LC_TIME, "d"); gives me 'oktober'? I'm on a Win 2k box.
Because locales are really system dependant, as you could clearly see using gettext translations. (I did fight with it ;) Win boxes (like yours) uses (M$) non standard locale names like English_United_States, French_Belgian, German_Standard, etc http://www.microsoft.com/globaldev/reference/win2k/setup/localsupport.mspx For Unix boxes, better use fr_BE, fr_FR (better avoid fr). Aliases like french can work, depending of local config. Syntax is simply <lang_code_lower>_<country_code_UPPER> where lang_code is the 2-letter std (iso639-2) http://www.loc.gov/standards/iso639-2/langcodes.html and country_code is the 2-letter std (iso3166) http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html If lucky, you can hope some common names are used, generally "french", "german", "dutch". But if you use gettext translations, the path used to fetch translations will differ (./locale/fr_BE/LC_MESSAGES/domain.mo for Unix boxes, ./locale/french/LC_MESSAGES/domain.mo for Win boxes). Seems there's no easy way other than copy the translations, if you're code is supposed to run across platforms :( PS Perhaps you can try the more specific php-i18n list. Cheers, Christophe

« previous php.general (#167239) next »