php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47479 Again: setlocale() ignores translation setting
Submitted: 2009-02-23 13:11 UTC Modified: 2010-01-13 02:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: szoftos at freemail dot hu Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.9RC3 OS: FreeBSD 7.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: szoftos at freemail dot hu
New email:
PHP Version: OS:

 

 [2009-02-23 13:11 UTC] szoftos at freemail dot hu
Description:
------------
Okay, i am posting this again, beacuse of my other bug was marked bogus, and i still think it's not:

on BSD systems, setlocale itself is not usable for gettext without putenv(). If I don't use putenv() with setlocale() (which is not enabled by default in safe_mode=on for $LANG), my own translations are not useable with gettext.

Since i use safe_mode, I'd not prefer enabling the setting of $LANG variable with putenv(). What I've seen during php ktracing, is that setlocale() only reads the original language settings from /usr/share/locale/*, but my own translations are not looked up.

Is there any way to fix that functionality? Maybe it's more BSD related than I think. KEEP IN MIND: If you would like to build a multi-langual site with gettext, and the language have to be switched on-the-fly, you HAVE TO set te $LANG variable on each run. I was told to set it at runtime, but this is NOT an ELIGIBLE solution.

Please don't mark it bogus, because this is a real problem with safe_mode=on.

Reproduce code:
---------------
You can simply try the gettext module's own tests to test it in BSD.
They all will fail, because those tests aren't usint putenv().


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-23 13:13 UTC] szoftos at freemail dot hu
umm, sorry, i was mistyped.

I was told to set it at _startup_, but that's not good enough. I have to set it runtime.
 [2009-02-23 13:49 UTC] jani@php.net
Gettext just does not work other than using those environment variables. If you disable setting them, you disable gettext. This is not a PHP bug, just another gettext limitation.

Reclassified as documentation issue since this fact isn't mentioned in the gettext docus.
 [2009-02-23 14:01 UTC] szoftos at freemail dot hu
Right, thanks, this is a good answer to me.

I only was too pushing because of that. The documentation should be clear this issue. And i was spending one day resolving that problem.

Thank you.
 [2010-01-13 02:01 UTC] svn@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=293477
Log: Fixed bug #47479 (setlocale() ignores translation setting)
 [2010-01-13 02:01 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=92b7deb01145af947241b61749ba04f54bcf003b
Log: Fixed bug #47479 (setlocale() ignores translation setting)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 29 11:00:03 2025 UTC