php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8969 Gettext does not work
Submitted: 2001-01-28 14:30 UTC Modified: 2002-06-08 10:48 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: teejun at vallcom dot com Assigned:
Status: Not a bug Package: Gettext related
PHP Version: 4.0.4pl1 OS: Linux RedHat 7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: teejun at vallcom dot com
New email:
PHP Version: OS:

 

 [2001-01-28 14:30 UTC] teejun at vallcom dot com
1) Just to show that gettext works in the system:
A script:
[teemu@jolly Test]$ cat loca2.sh
#!/bin/sh
LANG=fi
export LANG
TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAINDIR
TEXTDOMAIN=rpm
export TEXTDOMAIN
gettext "query package owning <file>"
echo

Run the script:
[teemu@jolly Test]$ sh loca2.sh 
kysy pakettia, jonka omistuksessa <tiedosto> on

2) Try the same with PHP:
A script:
[teemu@jolly Test]$ cat loca2.php 
<?php
 putenv ("LANG=fi");
 bindtextdomain ("rpm", "/usr/share/locale");
 textdomain ("rpm");
 print (gettext ("query package owning <file>"));
 print ("\n");
?>

Running it:
[teemu@jolly Test]$ /var/www/cgi-bin/php loca2.php 
X-Powered-By: PHP/4.0.4pl1
Content-type: text/html

query package owning <file>

3) My configure line:
[teemu@jolly Test]$ strings /var/www/cgi-bin/php | grep configure
 './configure' '--with-config-file-path=/etc/httpd/conf' '--enable-track-vars' '--enable-force-cgi-redirect' '--with-gettext'

4) I am using the php.ini-dist without modifications.

I have the same problem even if I try to use php-4.0.4pl1-3 (RedHat rpm)
and with php 4.0.2

I have installed my RedHat 7.0 about one month ago and I have run up2date several times.

I saw another report on gettext in problem #8444. The problem was fixed by reinstalling linux.  I really don't feel for reinstalling my OS. And I am afraid that it would only fix the problem temporarily (untill I update my system).

Best regards,
Teemu Junnila

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-31 05:13 UTC] teejun at vallcom dot com
I have done a bit more testing.
If I add:
	setlocale("LC_ALL", "fi_FI");
or just (for the messages):
	setlocale("LC_MESSAGES", "fi_FI");

Then the gettext function gives me  the correct text in Finnish.

It seems to be so that this has something to do with the latest updates (glibc?)
for linux.
The real problem is that if I need to make translations for languages I do not have
any locales installed on the system  it does not work. It used to, and it still should
work.
The "gettext" in linux distribution works by just defining LANG, it does not
need the whole locale.

IMHO: when I say: putenv("LANG=fi"); bindtextdomain("rpm", "/usr/share/local");
the gettext should look in /usr/share/local/fi/rpm.mo for the strings.
When I trace the program I can see that it does not go further than:
lstat ("/usr/share/locale",...
I feel that it tries to find out the last directory name in /usr/lib/locale/fi/LC... which does not exist).

Regards,
Teemu Junnila

 [2001-02-01 10:18 UTC] sniper@php.net
The documentation for gettext should be expanded a bit.
More examples and a link to the GNU gettext manual would
be nice.. :)

--Jani

 [2002-06-08 10:48 UTC] mfischer@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 23 23:01:23 2020 UTC