【问题标题】:JMS Translation Bundle @IgnoreJMS 翻译包@Ignore
【发布时间】:2014-06-10 14:17:07
【问题描述】:

我在一个项目中使用 JMS Translation Bundle (https://github.com/schmittjoh/JMSTranslationBundle)。

我有这个函数,它返回一个数组,每个标签前都有@Ignore。但是即使存在@Ignore,JMS 也会生成翻译密钥。

private function getStatusSelect()
{        
    return array(
        "URLverify"=>array(
            'label' => /** @Ignore */'Certificates left',
            'url'   => $this->generateUrl('admin_liste_verif_ready'),
        ),          
        "URLlistToAccept"=>array(
            'label' => /** @Ignore */'List to accept',
            'url'   => $this->generateUrl('admin_liste_verif'),
        ),
        "URLaccepted"=>array(
            'label' => /** @Ignore */'Accepted',
            'url'   => $this->generateUrl('admin_liste_index_accepted_action'),
        ),
        "URLrejected"=>array(
            'label' => /** @Ignore */'Rejected',
            'url'   => $this->generateUrl('admin_liste_index_rejected_action'),
        ),                        
    );
}

在我的代码中的许多其他地方,@Ignore 都可以正常工作,但在这种情况下不是。

你知道为什么吗?

谢谢你

布菲

【问题讨论】:

标签: symfony translation


【解决方案1】:

我一直认为你应该在键之前添加这个。 JMSTranslationBundle 查找“标签”键并尝试从中提取翻译。 (与“选择”键相同)。请尝试以下操作:

private function getStatusSelect()
{        
    return array(
        "URLverify" => array(
            /** @Ignore */
            'label' => 'Certificates left',
            'url'   => $this->generateUrl('admin_liste_verif_ready'),
        ),
        // ...
    );
}

【讨论】:

    猜你喜欢
    • 2014-12-22
    • 2023-03-24
    • 1970-01-01
    • 2016-11-18
    • 2010-12-24
    • 1970-01-01
    • 1970-01-01
    • 2016-03-05
    • 2012-08-22
    相关资源
    最近更新 更多