php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #40298 Gettext needs a do_not_use_fallback parameter
Submitted: 2007-01-31 19:39 UTC Modified: 2007-01-31 19:46 UTC
From: redlizard at redlizard dot nl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.0 OS: Irrelevant
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: redlizard at redlizard dot nl
New email:
PHP Version: OS:

 

 [2007-01-31 19:39 UTC] redlizard at redlizard dot nl
Description:
------------
When using gettext($somestring), if $somestring could not be translated, it is returned without further translation. There should be a possibility to return a specific value if the string could not be translated instead. This impossibility is rather annoying when writing a sophisticated i18n system.

Reproduce code:
---------------
// suggested solution:
$translated_text = gettext("some_string", true /* this optional parameter stands for "return false if text could not be translated" */);

if($translated_text === false) {
  echo "some_string could not be translated!\n";
} else {
  echo "some_string is $some_string in your favorite language\n";
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-31 19:46 UTC] tony2001@php.net
gettext() uses gettext() function (see `man 3 gettext`).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 29 21:00:01 2025 UTC