1

我已将SonataMediaBundle添加到我正在处理的项目中,该项目已经实现了SonataAdminBundle

奇怪的一件事是,开箱即用的表单/字段标签没有在管理仪表板或任何 CRUD 组件中进行翻译。

我虽然这是因为这是由捆绑提供的管理员与我编写的管理员,但我也集成了SonataUserBundle并且这些管理员的翻译很好(使用我假设的sonata.admin.label.strategy.native策略,根据这个是默认值,应该生成人类可读的标签)

这是该问题的说明:

未翻译标签的屏幕截图

另一个显示了即使在管理员旁边通过包含 SonataUserBundle 所暴露的翻译仍然无法正常工作。

仪表板上未翻译标签的屏幕截图

如果您需要查看其他内容,请告诉我。

对于版本信息,这是我的composer.json

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3"
      , "symfony/symfony": "2.3.*"
      , "doctrine/orm": ">=2.2.3,<2.4-dev"
      , "doctrine/doctrine-bundle": "1.2.*"
      , "twig/extensions": "1.0.*"
      , "symfony/assetic-bundle": "2.3.*"
      , "symfony/swiftmailer-bundle": "2.3.*"
      , "symfony/monolog-bundle": "2.3.*"
      , "sensio/distribution-bundle": "2.3.*"
      , "sensio/framework-extra-bundle": "2.3.*"
      , "sensio/generator-bundle": "2.3.*"
      , "incenteev/composer-parameter-handler": "~2.0"
      , "sonata-project/cache-bundle": "2.1.6"
      , "sonata-project/admin-bundle": "2.2.11"
      , "sonata-project/doctrine-orm-admin-bundle": "2.2.3"
      , "friendsofsymfony/user-bundle": "1.3.*"
      , "sonata-project/user-bundle": "2.2.3"
      , "stof/doctrine-extensions-bundle": "v1.1.0"
      , "sonata-project/formatter-bundle": "2.3.1"
      , "sonata-project/media-bundle": "2.2.3"
      , "sonata-project/core-bundle": "~2.2.5"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

config.yml的框架部分

framework:
    #esi:             ~
    translator:      { fallback: %locale% }
    secret:          %secret%
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_proxies: ~
    session:         ~
    fragments:       ~
    http_method_override: true
4

2 回答 2

2

我认为您应该尝试升级您的媒体包,因为您使用的是过时的版本。您使用的分支在 7 个月前进行了最后一次更改,所以如果我是您,我考虑升级到2.2.8,这有望解决问题。

于 2014-03-08T11:21:08.953 回答
1

也许您需要清除缓存文件。翻译文件需要在生成后清除缓存。

于 2014-07-09T10:23:09.697 回答