Forums / Installing on a Windows Server / locale not available on local server, maybe..

locale not available on local server, maybe..

Locked

Views: 7,868

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
26 Jul 2009, 6:49 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

locale not available on local server, maybe..

Hi,
I am developing an english/spanish cart on a windows 2000 local pc with xampplite.

When spanish is selected all text is in spanish apart from the day names which are in english.
After much reading around the subject on setlocale I discover that the problem seems to be with my local server.

I have used the code in the date wiki for testing the installed locales:

<?php echo "<hr><br>The available 'locale' strings for 'es' on this server are:<br>"; echo '<pre>'; system('locale -a | grep -i es'); echo '</pre>'; ?>

When I run this on my unix host, it returns a nice long list including es_ES.utf8 which I have been using.

When run locally on the windows 2000 machine it returns nothing, not with es, esp, spain or en, only the first line of the test:

The available 'locale' strings for 'en' on this server are:

Due to lack of knowledge I don’t know if I should be installing or enabling something on the server or maybe (more likely) it is not executing the system command, anyway after a LOT of searching I have to admit defeat and ask here, what do I do?

Thanks
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

26 Jul 2009, 7:47 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: locale not available on local server, maybe..

My guess (and it's little more than that) is that the xampplite package jettisons all the locale info as part of the lightening process. It's intended to be a very minimal installation, so carry all the baggage that comes with supporting every locale would logically be one of the fist things to jettison.

I'd say just don't worry about it, unless you're planning to actually run your site on xampplite, in which case it's your customers who should do the worrying. :wink:

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

26 Jul 2009, 8:53 PM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: locale not available on local server, maybe..

Hi,
thanks for the reply.
I have tried it with the full xampp and its just the same, thats why I think it has something to do with the system command not being executed.
I am not really worried about it but I am amazed I cannot find out the answer. I have the habit of wasting time trying to wrestle pcs to the ground and this is no exception,

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

27 Jul 2009, 1:38 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: locale not available on local server, maybe..

Sounds like the XAMPP forum would be a better place for getting to the bottom of this. They'll know better than us what's included and whether there's anything that can cause locales to be ignored if they're there.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

27 Jul 2009, 2:45 PM
#5
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: locale not available on local server, maybe..

And the winning answer is....

from the Apache forum:
"There is no command "locale" (and "grep") on Windows which you can execute with system()"

So the test code from the Zen Date Wiki could not work.

After asking another question I got a german version of RTFM and sent to the php manual where I copied some code, looked at the Microsoft Language and Region codes
http://msdn.microsoft.com/en-us/library/39cwe7zf%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/library/cdax410z%28VS.71%29.aspx
and made up a test for windows servers which may be of use to other geeks.

It fixed my "problem" in that it told me what to put in setlocale which was
@setlocale(LC_TIME, 'Spanish_Spain.1252'); for windows,
and
@setlocale(LC_TIME, 'es_ES.UTF8'); for UNIX

So, too many hours wasted on this silly issue but still, final score is computer 0 - human 1 which is how it should be.

echo '<hr>test UNIX server for locales';
echo "<br>The available 'locale' strings for 'en' on this server are:<br>";
echo '<pre>';
system('locale -a | grep -i en');
echo '</pre>';

// There is no command "locale" (and "grep") on Windows which you can execute with system()

echo '<hr>test WINDOWS server for locales';

/* try different possible locale names for english GB as of PHP 4.3.0 */
echo '<p>';
$loc_en = setlocale(LC_ALL, 'english_gbr', 'english_britain', 'english_england', 'english_great britain', 'english_uk', 'english_united kingdom', 'english_united-kingdom');
echo "Preferred locale for english GB on this system is '$loc_en'";
echo '<br/>' . strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));

/* try different possible locale names for english USA as of PHP 4.3.0 */
echo '<p>';
$loc_enusa = setlocale(LC_ALL, 'english_usa', 'english_america', 'english_united states', 'english_united-states', 'english_us');
echo "Preferred locale for english USA on this system is '$loc_enusa'";
echo '<br/>' . strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));

/* try different possible locale names for german as of PHP 4.3.0 */
echo '<p>';
$loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
echo "Preferred locale for german on this system is '$loc_de'";
echo '<br/>' . strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));

/* try different possible locale names for spanish as of PHP 4.3.0 */
echo '<p>';
$loc_es = setlocale(LC_ALL, 'esp_esp', 'esp_spain', 'spanish_esp', 'spanish_spain');
echo "Preferred locale for spanish on this system is '$loc_es'";
echo '<br/>' . strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));

/* try different possible locale names for dutch as of PHP 4.3.0 */
echo '<p>';
$loc_nl = setlocale(LC_ALL, 'nld_nld');
echo "Preferred locale for dutch on this system is '$loc_nl'";
echo '<br/>' . strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));

and what comes out on a unix server

test UNIX server for locales
The available 'locale' strings for 'en' on this server are:

en_AU
en_AU.iso88591
en_AU.utf8
en_BW
en_BW.iso88591
en_BW.utf8
en_CA
en_CA.iso88591
en_CA.utf8
en_DK
en_DK.iso88591
en_DK.utf8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_HK
en_HK.iso88591
en_HK.utf8
en_IE
en_IE.iso88591
en_IE.iso885915@euro
en_IE.utf8
en_IE@euro
en_IN
en_IN.utf8
en_NZ
en_NZ.iso88591
en_NZ.utf8
en_PH
en_PH.iso88591
en_PH.utf8
en_SG
en_SG.iso88591
en_SG.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
en_ZA
en_ZA.iso88591
en_ZA.utf8
en_ZW
en_ZW.iso88591
en_ZW.utf8
french
slovene
slovenian

test WINDOWS server for locales

Preferred locale for english GB on this system is ''
Friday 22 December 1978

Preferred locale for english USA on this system is ''
Friday 22 December 1978

Preferred locale for german on this system is 'de_DE@euro'
Freitag 22 Dezember 1978

Preferred locale for spanish on this system is ''
Freitag 22 Dezember 1978

Preferred locale for dutch on this system is ''
Freitag 22 Dezember 1978
and what come out on a windows server:
test UNIX server for locales
The available 'locale' strings for 'en' on this server are:

test WINDOWS server for locales

Preferred locale for english GB on this system is 'English_United Kingdom.1252'
Friday 22 December 1978

Preferred locale for english USA on this system is 'English_United States.1252'
Friday 22 December 1978

Preferred locale for german on this system is 'German_Germany.1252'
Freitag 22 Dezember 1978

Preferred locale for spanish on this system is 'Spanish_Spain.1252'
viernes 22 diciembre 1978

Preferred locale for dutch on this system is 'Dutch_Netherlands.1252'
vrijdag 22 december 1978

hasta pronto,

Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

27 Jul 2009, 2:53 PM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: locale not available on local server, maybe..

torvista:

So, too many hours wasted on this silly issue but still, final score is computer 0 - human 1 which is how it should be.Bravo. I also waste too much time on silly issues. But I learn something every time and each incremental piece of knowledge increases the range of tools that I have available to apply to the next problem.

Thanks for posting back what you found. That strengthens the whole community's toolset!

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)