symfony1 - 奇怪的 symfony i18n 错误

标签 symfony1 internationalization symfony-1.4

我使用 symfony 1.4.11。在我的网站中,我的网站有 3 种语言“se”、“en”、“no”。在我的后端,我只使用 en,并且我在设置中有:

全部:

  .settings:
    default_culture: en

但是在某些模块中,当在前端我有“se”语言时,出现错误:

找不到“se”的数据文件。

在前端,我尝试使用数据库进行 i18n 操作;

Stack trace:

stack trace
at ()
in SF_SYMFONY_LIB_DIR/i18n/sfCultureInfo.class.php line 301 ...

      if (is_file($filename) == false)

      {

        throw new sfException(sprintf('Data file for "%s" was not found.', $file));

      }


      if (in_array($filename, $this->dataFiles) == false)
at sfCultureInfo->loadCultureData('se')
in SF_SYMFONY_LIB_DIR/i18n/sfCultureInfo.class.php line 217 ...
at sfCultureInfo->__construct('se')
in SF_SYMFONY_LIB_DIR/i18n/sfCultureInfo.class.php line 136 ...
at sfCultureInfo::getInstance('se')
in SF_SYMFONY_LIB_DIR/i18n/sfDateTimeFormatInfo.class.php line 186 ...
at sfDateTimeFormatInfo::getInstance('se')
in SF_SYMFONY_LIB_DIR/i18n/sfDateFormat.class.php line 100 ...
at sfDateFormat->__construct('se')
in SF_SYMFONY_LIB_DIR/helper/DateHelper.php line 57 ...
at format_date('2011-07-22 01:36:02', 'f')
in SF_ROOT_DIR/cache/backend/dev/modules/autoSfGuardUser/templates/_list_td_tabular.php line 5 ...
at require('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/_list_td_tabular.php')
in SF_SYMFONY_LIB_DIR/view/sfPHPView.class.php line 75 ...
at sfPHPView->renderFile('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/_list_td_tabular.php')
in SF_SYMFONY_LIB_DIR/view/sfPartialView.class.php line 124 ...
at sfPartialView->render()
in SF_SYMFONY_LIB_DIR/helper/PartialHelper.php line 218 ...
at get_partial('sfGuardUser/list_td_tabular', array('sf_guard_user' => object('sfOutputEscaperIteratorDecorator')))
in SF_SYMFONY_LIB_DIR/helper/PartialHelper.php line 180 ...
at include_partial('sfGuardUser/list_td_tabular', array('sf_guard_user' => object('sfOutputEscaperIteratorDecorator')))
in SF_ROOT_DIR/cache/backend/dev/modules/autoSfGuardUser/templates/_list.php line 31 ...
at require('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/_list.php')
in SF_SYMFONY_LIB_DIR/view/sfPHPView.class.php line 75 ...
at sfPHPView->renderFile('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/_list.php')
in SF_SYMFONY_LIB_DIR/view/sfPartialView.class.php line 124 ...
at sfPartialView->render()
in SF_SYMFONY_LIB_DIR/helper/PartialHelper.php line 218 ...
at get_partial('sfGuardUser/list', array('pager' => object('sfOutputEscaperIteratorDecorator'), 'sort' => object('sfOutputEscaperArrayDecorator'), 'helper' => object('sfGuardUserGeneratorHelper')))
in SF_SYMFONY_LIB_DIR/helper/PartialHelper.php line 180 ...
at include_partial('sfGuardUser/list', array('pager' => object('sfOutputEscaperIteratorDecorator'), 'sort' => object('sfOutputEscaperArrayDecorator'), 'helper' => object('sfGuardUserGeneratorHelper')))
in SF_ROOT_DIR/cache/backend/dev/modules/autoSfGuardUser/templates/indexSuccess.php line 19 ...
at require('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/indexSuccess.php')
in SF_SYMFONY_LIB_DIR/view/sfPHPView.class.php line 75 ...
at sfPHPView->renderFile('/home/dan/WEB/www/europellets-dev.my/cache/backend/dev/modules/autoSfGuardUser/templates/indexSuccess.php')
in SF_SYMFONY_LIB_DIR/view/sfPHPView.class.php line 185 ...
at sfPHPView->render()
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 155 ...
at sfExecutionFilter->executeView('sfGuardUser', 'index', 'Success', array('configuration' => object('sfGuardUserGeneratorConfiguration'), 'helper' => object('sfGuardUserGeneratorHelper'), 'filters' => object('sfGuardUserFormFilter'), 'pager' => object('sfDoctrinePager'), 'sort' => array(null, null)))
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 116 ...
at sfExecutionFilter->handleView(object('sfFilterChain'), object('sfGuardUserActions'), 'Success')
in SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 47 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/filter/sfRenderingFilter.class.php line 33 ...
at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR/controller/sfController.class.php line 238 ...
at sfController->forward('sfGuardUser', 'index')
in SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line 48 ...
at sfFrontWebController->dispatch()
in SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 170 ...
at sfContext->dispatch()
in SF_ROOT_DIR/web/backend_dev.php line 13 ...

最佳答案

此错误意味着 SF_SYMFONY_LIB_DIR/i18n/data/目录中没有针对“se”区域性的 ICU 数据文件。 Symfony 支持多种文化,但不是全部。在您的情况下,如果“se”是瑞典语 - 使用“sv”代码。

sv          sv-SE       Swedish
sv-FI       sv-FI       Swedish (Finland)
sv-SE       sv-SE       Swedish (Sweden)

如果“se”不是瑞典语并且不在开箱即用列表中(请参阅 SF_SYMFONY_LIB_DIR/i18n/data/dir) - 使用内部标记而不是模式(例如 format_date($date, 'f' ) -> format_date($date, 'd MMMM YYYY, hh:mm')) formatDateHowTo

关于symfony1 - 奇怪的 symfony i18n 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6809852/

相关文章:

symfony1 - 如何仅通过 FTP 上传更新外部服务器上的 Symfony 路由?

ruby-on-rails - 在 I18n 插值中使用另一个 I18n 键

ios - 基于 Iphone 电话号码格式化语言环境

PHP 警告 : array_shift() expects parameter 1 to be array, null 在/home5/.../php/symfony/command/sfCommandManager.class.php 中给出

symfony1 - 插槽在行动?

php - 在 Doctrine PHP Symfony 中覆盖 Doctrine_Record (sfDoctrineRecord) 实例方法

php - 左加入 Doctrine 查询语言

android - 如何在 Android 中支持阿拉伯语文本?

php - Doctrine 的 addColumn() 迁移方法有哪些选项?

php - 如何在 symfony 中检索一个 ID 之后的所有记录?