473,569 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gettext doesn't worh, help!

Hello,

I'm testing gettext on my website but it doesn't work.

phpinfo returns correct informations:
configure command => '--with-gettext=/usr'
GetText Support => enabled

I have no problem to create messages.mo and messages.po files.
I've created all directories under a 'locale' root directory
../locale/fr_FR/LC_MESSAGES/messages.mo
../locale/fr_FR/LC_MESSAGES/messages.po
../locale/en_US/LC_MESSAGES/messages.mo
../locale/en_US/LC_MESSAGES/messages.po
Here's the source of a fr_FR messages.po (en_US is similar):
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2004 Free Software Foundation, Inc.
# Daniel xxx <xx*@yyy.com> , 2004.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2004-07-06 13:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Daniel xxx <xx*@yyy.com>\n "
"Language-Team: French <tr****@traduc. org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

# Exemples de texte a traduire

msgid "ADM0001"
msgstr "Traduction en cours ..."

msgid "ADM0002"
msgstr "Verifiez les valeurs de vos variables"

Here's the source of a test script:
// Specification de la langue dans la variable d'environnement LANG.
$vLang=getenv(" LANG");
echo "Variable d'environnement LANG = " . $vLang;
echo "<BR />\n";
putenv("LANG=en _US");
$vLang=getenv(" LANG");
echo "Variable d'environnement LANG = " . $vLang;
echo "<BR />\n";
$vLC_ALL = getenv("LC_ALL" );
echo "Variable d'environnement LC_ALL = " . $vLC_ALL;
echo "<BR />\n";
$vLocale = setlocale(LC_AL L, "en_US");
echo "Variable locale LC_ALL = " . $vLocale;
echo "<BR />\n";
$vLC_ALL = getenv("LC_ALL" );
echo "Variable d'environnement LC_ALL = " . $vLC_ALL;
echo "<BR />\n";

// Test de gettext
$vDomaine = "messages";
$vCodeset = bind_textdomain _codeset($vDoma ine, "ISO-8859-1");
echo "Resultat de bind_textdomain _codeset = " . $vCodeset;
echo "<BR />\n";
$vBind = bindtextdomain( $vDomaine, "./gettext/locale");
echo "Resultat de bindtextdomain = " . $vBind;
echo "<BR />\n";
$vTextDomain = textdomain($vDo maine);
echo "Resultat de textdomain = " . $vTextDomain;
echo "<BR />\n";

echo gettext("ADM000 1");
echo "<BR />\n";
echo gettext("ADM000 2");
echo "<BR />\n";
echo gettext("ADM000 3");
echo "<BR />\n";
echo _("ADM0001");
echo "<BR />\n";
echo _("ADM0002");
echo "<BR />\n";
echo _("ADM0003");
echo "<BR />\n";

Here's the result of th script:
Variable d'environnement LANG = en_us
Variable d'environnement LANG = en_US
Variable d'environnement LC_ALL = en_US
Variable locale LC_ALL = en_US
Variable d'environnement LC_ALL = en_US
Resultat de bind_textdomain _codeset = ISO-8859-1
Resultat de bindtextdomain = /home/web/site123/admin/gettext/locale
Resultat de textdomain = messages
ADM0001
ADM0002
ADM0003
ADM0001
ADM0002
ADM0003
I don't understand what's wrong, I've run the test script with fr_FR
configuration too, the result is the same, only the msgid is displayed,
help needed.
Regards,
Daniel
Jul 17 '05 #1
0 1910

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

Similar topics

1
3622
by: Dave Patton | last post by:
Can someone point me to a definitive source for the answers to the following two questions: 1) In an environment with Redhat Linux 2.4.21-27.0.1, Apache 1.3.31, PHP 4.3.10, and GNU gettext 0.14.1, will using PHP's gettext support along with the GNU gettext utilities work properly? For example, I've seen references to the translated...
14
2604
by: Pierre Rouleau | last post by:
I have a problem writing self-testable modules using doctest when these modules have internationalized strings using gettext _('...'). - The main module of an application (say app.py) calls gettext.install() to install the special _ function inside Python builtin. Other modules, taken from a general purpose collection of Python modules,...
13
3930
by: cantabile | last post by:
Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : ================ test.py import gettext gettext.install('')
7
2781
by: russ.phillips.nospam | last post by:
Hi, I'm trying to use gettext to internationalise my project , but I'm getting the following error message with some translations: "Traceback (most recent call last): file PanicButton.py line 36 in ? file Gettext.pyc line 177 in _init_ file Gettext.pyc line 274 in _parse struct.error : unpack str size does not match format"
0
1282
by: redhog | last post by:
I can not get gettext to work at all under PHP. I run ubuntu 6.06.1 LTS, and the php5 package there announces that it supports gettext. Also, php -i sais gettext GetText Support =enabled, so it should be working. Here follows a minimal example that should be working, but isn't (gettext and msgfmt are the normal GNU gettext tools): $ cat...
4
2360
by: Mike P2 | last post by:
Hi. Does anyone here have experience with PHP gettext functions? I'd like to know how they work better. Also, is gettext more efficient than serializing the language strings into language files and unserializing them at each request? I found this on Google saying that some guy sped up gettext, but I have no idea how fast it was in the first...
1
3232
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details right. * http://docs.python.org/lib/node738.html Here's what I finally came up with as the simplest instructions, suitable for an "overview of...
6
2018
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I've encountered a problem using gettext with properties while using a Python interpreter. Here's a simple program that illustrate the problem. ============== # i18n_test.py: test of gettext & properties import gettext fr = gettext.translation('i18n_test', './translations',
2
4419
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 apt-get install php-gettext apt-get install php5-cli apt-get install php5 php5-common
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.