Symfony 1.4 i18n助手在行动

时间:2014-02-11 12:08:42

标签: internationalization symfony-1.4

我在Symfony 1.4操作中使用I18n _ ()时遇到问题。 在我调用_ ('test',null,'translation')的组件中,我得到'abcd',但是当我在操作中调用它时,我得到'test'。这表明它不是xliff文件的问题。

在settings.yml中有i18n

all:
  .actions:
    error_404_module:       errors   # To be called when a 404 error is raised
    error_404_action:       error404  # Or when the requested URL doesn't match any route
#
    login_module:           default   # To be called when a non-authenticated user
    login_action:           login     # Tries to access a secure page
#
    secure_module:          default   # To be called when a user doesn't have
    secure_action:          secure    # The credentials required for an action
#
#    module_disabled_module: default   # To be called when a user requests 
#    module_disabled_action: disabled  # A module disabled in the module.yml
#
  .settings:

     i18n:                   on  

问题甚至没有解决添加到操作 sfContext ::的getInstance() - > getConfiguration() - > loadHelpers(阵列( 'I18N'));

1 个答案:

答案 0 :(得分:0)

尝试这种方式:

$this->getContext()->getI18N()->__($text, $args, 'translation');