Bug #68216 [Nab]: gettext can not be used inside a class
| From: | klwang at klwang dot info | Date: | Mon, 13 Oct 2014 07:50:22 +0000 |
| Subject: | Bug #68216 [Nab]: gettext can not be used inside a class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188049@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68216&edit=1
ID: 68216
User updated by: klwang at klwang dot info
Reported by: klwang at klwang dot info
Summary: gettext can not be used inside a class
Status: Not a bug
Type: Bug
Package: Gettext related
Operating System: Ubuntu 10.04 LTS
PHP Version: 5.4.33
Block user comment: N
Private report: N
New Comment:
many thanks for your reply, but how can i internationalisation the string this case?
thanks again!
Previous Comments:
------------------------------------------------------------------------
[2014-10-13 07:32:15] requinix@php.net
You cannot use a function call in the default value of a member variable - only constants and (with
PHP 5.6+) constant expressions.
------------------------------------------------------------------------
[2014-10-13 07:28:19] klwang at klwang dot info
Description:
------------
when gettext use in a class, it will be not work.
with an error message like below:
PHP Parse error: syntax error, unexpected '(', expecting ',' or
';' in /tmp/1.php on line 3
Test script:
---------------
<?
class class_test{
public static $i18n_test = _("i18n test");
}
echo class_test::$i18n_test;
?>
Expected result:
----------------
the gettext can use inside a class
Actual result:
--------------
gettext can not be used inside a class
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68216&edit=1