【问题标题】:CakePHP 3 : How to prepare cakephp table paginate header for localization?CakePHP 3:如何为本地化准备 cakephp 表分页标题?
【发布时间】:2018-07-08 05:43:34
【问题描述】:

我的表头如下所示

<th scope="col"><?= $this->Paginator->sort('name')?></th>

生成 POT 文件 'name' 后没有生成 'msgid' 和 'msgstr'。

我试过下面的代码,但结果是一样的。

<th scope="col"><?= __($this->Paginator->sort('name')) ?></th>

在生成 POT 文件之前我将如何准备它?

【问题讨论】:

    标签: cakephp cakephp-3.0 cakephp-3.x


    【解决方案1】:

    你可以写你的标签像

    <th scope="col"><?= $this->Paginator->sort('name',__('Name')) ?></th>
    

    【讨论】:

      【解决方案2】:

      排序函数中的键名用于对记录集进行排序。您不能使用它在 POT 文件中生成“msgid”和“msgstr”。

      您可以通过在别处定义它来生成 msgid 和 msgstr,例如

      <? = __('name') ?>;
      
      PaginatorHelper::sort($key, $title = null, $options = array())
      

      供您参考: https://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html

      【讨论】:

        猜你喜欢
        • 2019-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-17
        • 2011-03-10
        • 1970-01-01
        • 1970-01-01
        • 2015-09-14
        相关资源
        最近更新 更多