php - 如何在 prestashop Controller 中使用翻译?

标签 php controller translation prestashop

通常模板有一个像这样的 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/

相关文章:

php - 多个复选框随行更新

ajax - Controller中对AJAX进行的操作在GRAILS中获取请求

asp.net-mvc-4 - TempData 仅显示在子部分 View 中,而不显示在父部分 View 中

javascript - 实时 JavaScript 翻译闪烁

Django 1.5.5 始终显示原始 (en) 字符串(不翻译)

java - 有没有办法将用 Java 编写的代码转换/翻译成其他语言?

Phpredis 前置值——无法弄清楚为什么

php - 使用 MySQL 和 PHP 的最佳匹配

PHP echo html 表格错误

controller - 我不明白PID Controller 的积分部分