By h4rp0on3r on
I created a Constants class which holds arrays used throughout my app. However, the following code errors out:
class Constants
{
public $some_arr = array (t('Some string'), t('Some string2')); // error
}
I see that without the t() function, everything works as intended:
class Constants
{
public $some_arr = array ('Some string', 'Some string2'); // works
}
The constants class is located in another module's folder. It is included using
require_once("$path/my_module_constants.php");
How do I provide support for internalization/translations within objects (if possible)?
How can I make this external code aware of the t() function?
Thank you in advance.