473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP + gettext on Debian Woody 3.0 stable: Resolution

After several hours I found out how to make this work:

1) Here is the test.php script, "Who are we" is the message for the
translation

<?
$language = "de_DE";
putenv("LC_ALL=$language");
$locale = setlocale(LC_ALL, $language);
echo "locale='$locale'";
echo "<br>";
echo "<br>";

$domain = "messages";
bindtextdomain($domain, "./locale");
textdomain($domain);

echo _("Who are we");

die;
?>

2) Message file is ./locale/de_DE/LC_MESSAGES/messages.mo in my case

3) Here is the trick: de_DE locales must be generated by Debian
administrator (root), otherwise setlocale() function returns ""
(failure) instead of "de_DE" !

One of the ways how to do that is "dpkg-reconfigure locales". Check
"de_DE ISO-8859-1" option, it will generate /usr/lib/locale/de_DE for
you.

4) Another trick: restart Apache

5) Now it should work; test.php prints "Who are we in GERMAN" string
for me

Martin
Jul 17 '05 #1
0 1420

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rene Pijlman | last post by:
There doesn't seem to be an apt package for Python 2.3 on Debian Woody. Should I expect unusual difficulties or unsolvable problems when building and installing 2.3 on Woody from the source...
2
by: Herbert Straub | last post by:
What could be wrong with this simple test program: #include <string> #include <iostream> class foo { std::string s; public: foo (const char *a) : s(a) {};
3
by: Martijn van Oosterhout | last post by:
Hi, Does anyone have any packages for 7.3.4 for debian woody? Thanks in advance, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > "All that is needed for the...
7
by: Oliver Elphick | last post by:
Debian packages of 7.4 have been uploaded to Debian's experimental archive. Because of certain issues with interlocking dependencies, I will not move them to unstable until version 7.3.4-9 is...
1
by: Erwin Brandstetter | last post by:
Hi Newsgroup! Some weeks back (2003-11-18), Oliver Elphick wrote in this newsgroup: > A version built for woody (stable) is available at > http://people.debian.org/~elphick/debian This is...
4
by: Brian van den Broek | last post by:
Hi all, I know that this is something for which I could (keep) STFW, but I'm mostly ignorant of the subject area and under a bit of a deadline. So I hope people won't mind if I truncate my...
6
by: BartlebyScrivener | last post by:
If there is a wxPython on Debian user in the house? I am using the version of the demo that came with the apt-get download of wxPython. I thought I'd followed the instructions for installing and...
2
by: paolob | last post by:
Hi to all, I'm running php 5.2.5 on Debian etch, with apache 2.0.56. I need to include, in php.ini, gettext.so library but I didn't find anything. I've already install: apt-get install gettext...
8
by: howa | last post by:
http://hk2.php.net/manual/en/ref.gettext.php I just wonder why those kind of translation/mapping can't be implemented in using plain PHP array? Howard
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.