php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30597 GETTEXT strings occasionally don't get translated
Submitted: 2004-10-28 13:40 UTC Modified: 2005-01-15 01:00 UTC
Votes:28
Avg. Score:4.9 ± 0.4
Reproduced:28 of 28 (100.0%)
Same Version:1 (3.6%)
Same OS:1 (3.6%)
From: schnaaf at home dot nl Assigned:
Status: No Feedback Package: Gettext related
PHP Version: 4.3.8 OS: FreeBSD 4.7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-10-28 13:40 UTC] schnaaf at home dot nl
Description:
------------
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mysql=/usr/local' '--with-ttf' '--enable-safe-mode' '--enable-memory-limit' '--enable-track-vars' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-tiff-dir=/usr/local' '--with-png-dir=/usr/local' '--enable-bcmath' '--enable-versioning' '--enable-trans-sid' '--with-zlib' '--with-xml' '--enable-gd-imgstrttf' '--with-mcrypt' '--with-expat=/usr/local' '--enable-calendar' '--enable-ftp' '--enable-calendar' '--with-mhash' '--with-curl=/usr/local/include/curl' '--with-openssl' '--with-xml' '--with-dom=/usr/local' '--enable-wddx' '--with-sablot=/usr/local' '--with-expat=/usr/local' '--enable-xslt' '--with-xslt-sablot' '--with-dom-xslt=/usr/local' '--disable-cgi' '--with-gettext' 

Reproduce code:
---------------
I have an application written in PHP with gettext support in a particular script. Every now and
then the messages in this particular script don't get translated. A refresh of the page will sometimes
help. But after reloading the page about five times the untranslated strings
show up again. There seems to be no clear reason why this happens. Anybody?

Expected result:
----------------
translated strings

Actual result:
--------------
sometimes the string gets translated sometimes it doesn't in the same script

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-16 17:26 UTC] tony2001@php.net
Try to upgrade your gettext installation first.
 [2004-11-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-01-07 14:38 UTC] alain at parkautomat dot net
I updated to the newest gettext and I still have the problem. It only shows on texts with german 'Umlaut's as sources.

All other text fragments are translated, just those with the Umlauts are not translated - most of the time. It looks like it only translates one entry and leaves the others untranslated.
 [2005-01-07 15:03 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2005-01-07 15:56 UTC] alain at parkautomat dot net
http://parkautomat.net/php4gettextbug.tar.gz

It includes a sample php file and some translated messages. This shows the exact problem here.

Distribution: Debian GNU/Linux
Versions:
gettext        0.14.1
php4           4.3.9
apache         1.3.26.1
 [2005-01-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-02-23 22:32 UTC] wolfgang dot pichler at ivv dot tuwien dot ac dot at
same phenomenon observed in project www.emilda.org from different people with different versions of apache,php,gettext,linux ....

VERY SPURIOUS

i would think it is some major php design bug :-)
 [2005-11-07 10:31 UTC] c dot affolter at stepping-stone dot ch
Same problem encountered with PHP 5.1.0RC1/Apache 2, gettext 0.13.

As mentioned in the previous comment, it seems to be a PHP issue, since the translation is working correctly via the native gettext command.
 [2011-09-06 12:35 UTC] teemu at 1up dot fi
Just for a notice, you have to restart Apache (or whatever) every single time 
when you do any kind of modifications into the translations file. If you don't, 
gettext will sometimes return your new string but instead it will return more 
often that string, what's passed to it as an argument. So the translation with 
gettext don't work properly if you don't restart your www-daemon.
 [2019-10-04 13:33 UTC] c3337963 at urhen dot com
Reproduced for PHP 5.3 / Appweb 4.7 / gettext 0.19 on Linux
with code like:
----------------
  ...
// we want only LC_MESSAGES to be affected, so...
// (according to http://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html)
  putenv('LANGUAGE=');
  putenv('LANG=POSIX');
  setlocale(LC_ALL, '');
  setlocale(LC_MESSAGES, 'cs_CZ.utf8');

  bindtextdomain('messages', '/opt/app/locale');
  bind_textdomain_codeset('messages', 'UTF-8');
  textdomain('messages');
  ...
// and now use _()
  ...
----------------
and /opt/app/locale/cs/LC_MESSAGES/messages.mo file.

Also one can check the following SO link:
https://stackoverflow.com/questions/10508305/gettext-works-sometimes

Is there any workarounds or something?
 [2020-10-06 14:20 UTC] jannacecek at seznam dot cz
I have the same problem with gettext and dockerized debian (FROM php:7.4-apache). For me it takes exactly 102 page reloads to switch between a translation and the default text (102 times transalted string, then 102 times untranslated string). I'm puzzled!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC