Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用DEFINE变量时Prestashop中的转换_Php_Translation_Prestashop - Fatal编程技术网

Php 使用DEFINE变量时Prestashop中的转换

Php 使用DEFINE变量时Prestashop中的转换,php,translation,prestashop,Php,Translation,Prestashop,例如,当我定义define(我的文本,“我的文本”)并在Prestashop模块$this->l(我的文本)中使用它时,它工作得很好(因此我可以在单独的include文件中分离大块文本) 但是当我为另一种语言使用翻译(工具)时,每一个使用定义变量的文本都不再显示了 所以我不知道用另一种语言来翻译这些,也许用md5编码的结构不会被识别 我不知道您为什么使用define进行文本翻译?但这会让事情变得更复杂。只需将文本放入模块中,就像 $this->l('Your text here'); 就

例如,当我定义define(我的文本,“我的文本”)并在Prestashop模块$this->l(我的文本)中使用它时,它工作得很好(因此我可以在单独的include文件中分离大块文本)

但是当我为另一种语言使用翻译(工具)时,每一个使用定义变量的文本都不再显示了


所以我不知道用另一种语言来翻译这些,也许用md5编码的结构不会被识别

我不知道您为什么使用define进行文本翻译?但这会让事情变得更复杂。只需将文本放入模块中,就像

$this->l('Your text here');
就这样,你可以把文本翻译成你想要的任何语言

谢谢

这里是
classes/module/module.php中的“l”函数

abstract class ModuleCore
{
    public function l($string, $specific = false)
    {
       ............
    }
}
因此子类从
ModuleCore
扩展而来,可以对翻译文本使用函数
l
。 在您的情况下,您应该在模块类中使用函数
$this->('yourtext')