通常模板有一个像这样的 smarty 函数:{l s="string"}
,而模块只使用 $this->l('string');
。在 Controller 上,l() 函数似乎不可用,所以如果我想设置一些从后台翻译的文本,该怎么办?
最佳答案
它可以在 Controller 中使用,您只需在游戏中添加模块对象即可。
你应该这样做
$this->module->l('Your string to translate', 'file_name');
例如,如果您在 validation.php
中,您的 'file_name'
应该只是 'validation'
完整的示例如下所示
$this->module->l('Your string to translate', 'validation');
关于php - 如何在 prestashop Controller 中使用翻译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33722203/