gettext not working under local xampp - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-13-2010, 06:38 AM   #1 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 11
Send a message via Skype™ to thosecars82
Default gettext not working under local xampp

I have this code
Code:
<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: ...
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htt..xhtml1-transitional.dtd">
<html xmlns="htt...w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
$language="fr_FR";
putenv("LC_ALL=$language");
setlocale(LC_ALL, $language);
bindtextdomain("messages", "./locale");
textdomain("messages");
print "<p>"._("hi! This website is written in English.")."</p>\n";
?>
</body>
</html>
and no matter what string I set the variable $language with that gettext will always look for a translation in the folder locale\es_ES\LC_MESSAGES whether the language is Spanish (es_ES) or not. For example, in the above code, gettext will not look for the French translation as it should in
locale\fr_FR\LC_MESSAGES but it will look for the translation into the folder corresponding to Spanish language, that is to say, locale\es_ES\LC_MESSAGES.

Moreover, if gettext does not find the folder locale\es_ES\LC_MESSAGES then
it will display the string in the original language(English) even if $language equals "fr_FR" and at the same time there is a locale\fr_FR\LC_MESSAGES folder created and the corresponding messages.mo and messages.po files created in this folder.

I made sure that I re-run Apache and MySql under Xampp whenever I change anything in the code but it keeps having this undesired behaviour anyways.

Do you have any idea about why only translations in .po files in the Spanish folder locale\es_ES\LC_MESSAGES are considered and not those translations corresponding to other languages and their corresponding folders?

Thanks in advance.
thosecars82 is offline   Reply With Quote
Sponsored Links
Old 04-15-2010, 06:20 AM   #2 (permalink)
Junior Member
 
php_mysql_coder's Avatar
 
Join Date: Apr 2010
Posts: 2
Send a message via MSN to php_mysql_coder
Cool Re: gettext not working under local xampp

try to use local -a in order to understand if corresponding language package is installed or not. after that please tell me the result I would try help you according the result you take.

in addition:

use this if your language pack do not exist:

setlocale("LC_ALL", "your_language");
php_mysql_coder is offline   Reply With Quote
Old 04-15-2010, 06:54 AM   #3 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 11
Send a message via Skype™ to thosecars82
Default Re: gettext not working under local xampp

Quote:
Originally Posted by php_mysql_coder View Post
try to use local -a in order to understand if corresponding language package is installed or not. after that please tell me the result I would try help you according the result you take.

in addition:

use this if your language pack do not exist:

setlocale("LC_ALL", "your_language");
The problem is that I am running windows.
Look at this link

bugs dot php dot net slash bug dot php?id=49349

It seems this is a bug which happens when running xampp in windows.
So, thank you very much for your suggestion but i think it will not work for the reson I mentioned and I will not test that for the time being. But if you think I should still try what you told me, let me know.
Thanks
thosecars82 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:48 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting