gettext translates ALWAYS?
Posted on
16th Feb 2014 07:03 pm by
admin
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)
gettext-support is enabled.
It used to work perfectly a few weeks ago.
I'm not quite sure what changed this. Be it source changes or the new PHP version.
Now it's translating all the time to Germany although the default-language is English.
To test this, I got 2 files:
gettext.php
Code: <?php
error_reporting(E_ALL);
include("config.inc.php");
echo $locale;
setlocale(LC_ALL, "eng_USA");
echo '
'.gettext('Which data is transferred by the client ?');
?>
localization.php
Code: <?php
$locale = '';
$parameter=explode ( '/' , $_SERVER['REQUEST_URI']);
$locale_change = $parameter[1];
if ($locale_change!=false)
{
if ($locale_change=="de")
{
$locale = "de_DE";
setcookie("locale", $locale, time()+60*60*24*30, "/");// save a cookie
}
else if ($locale_change=="en")
{
$locale = "en_US";
setcookie("locale", $locale, time()+60*60*24*30, "/");// save a cookie
}
}
if (!$locale && isSet($_COOKIE["locale"]))
{
$locale = $_COOKIE["locale"];
}
$locale="en_US";
putenv("LC_ALL=$locale");//needed on some systems
putenv("LANG=$locale");//needed on some systems
putenv("LANGUAGE=$locale");//needed on some systems
bindtextdomain("messages", "./locale/");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
?>
The output is always:
en_US
Welche Daten sendet die Client-Software ?
setlocale return false for en_US. If I use the Windows-typical notation "eng_USA" then it returns
English_United States.1252 but the text will be translated to German anyways :/
I have really no clue what's going wrong.
I've put together these test-file and the local files if you want to see yourself what is going wrong. You can download it via www.ali.dj/gettext.zip
No comments posted yet
Your Answer:
Login to answer
302
30
Other forums
strtotime issue
Hey all,
I'm playing around with some code, and basically the idea is:
Person changes
Navigation include for all site directories
Hi,
I need a navigation include that can deal with directories at different levels on a site.
re calling a function without including file
Hi,
i am new to programming in php, i was just checking the wordpress code and found out in the w
Can I call a class inside a function?
I have a class written in another file that handles my image resizing.
Can I do this (php say
b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)
Accessing Infotype data in dialog program
Hi All
In Dialog programs attributes I didn't see any logical database field. How can I access
Giving the below syntax error
Dear Experts,
I have used 2 buttons in gui status as display and cjhange.When the user wi
Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data
unexpected T_VARIABLE error
Hey all! I'm getting an unexpected T_VARIABLE with the following function:
function getHighes
delete comma
HI,
How to delete "," at the end of the string.
Code: $match = 2009/02/03/a2corr