473,321 Members | 1,669 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,321 software developers and data experts.

Gettext fails me

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):

[redhog@thalari:~/Projects/DemoWave]$ cat foo.php
#! /usr/bin/php
<?php
bindtextdomain($argv[1], $_ENV['TEXTDOMAINDIR']);
echo dgettext($argv[1], $argv[2]);
?>
[redhog@thalari:~/Projects/DemoWave]$ cat
locale/sv_SE/LC_MESSAGES/demowave.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2006 RedHog (Egil Möller) <re****@redhog.org>
# RedHog (Egil Möller) <re****@redhog.org>, 2006
#
msgid ""
msgstr ""
"Project-Id-Version: DemoWave 0.9\n"
"POT-Creation-Date: Sun Oct 24 19:51:42 2004\n"
"PO-Revision-Date: 2004-10-24 21:02+0200\n"
"Last-Translator: RedHog (Egil Möller) <re****@redhog.org>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
#
msgid "A message"
msgstr "Ett meddelande"
[redhog@thalari:~/Projects/DemoWave]$ msgfmt -o
locale/sv_SE/LC_MESSAGES/demowave.mo
locale/sv_SE/LC_MESSAGES/demowave.po
[redhog@thalari:~/Projects/DemoWave]$ ./foo.php demowave "A message"
A message[redhog@thalari:~/Projects/DemoWave]$
[redhog@thalari:~/Projects/DemoWave]$ gettext demowave "A message"
Ett meddelande[redhog@thalari:~/Projects/DemoWave]$
[redhog@thalari:~/Projects/DemoWave]$
Could someone please help?
Thanks in advance,
Egil

Nov 9 '06 #1
0 1270

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

Similar topics

0
by: Daniel CAUSSE | last post by:
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...
1
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...
14
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...
1
by: Terry Hancock | last post by:
I'm looking at the gettext module for the first time and learning how to write internationalized code in Python. Naturally, I also looked at the original Gnu gettext manual, which mentions that...
13
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('')
2
by: Thomas W | last post by:
I'm trying to wrap my head around the docs at python.org related to the gettext-module, but I'm having some problem getting it to work. Is there any really simple, step-by-step on how to use this...
1
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...
6
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 &...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.