标签不会通过SonataMediaBundle的管理集成进行翻译

时间:2014-03-05 05:22:42

标签: php symfony sonata-admin symfony-2.3 sonata-media-bundle

我已将 SonataMediaBundle 添加到我正在实施 SonataAdminBundle 的项目中。

奇怪的一点是,开箱即用的表格/字段标签不会在管理信息中心或任何CRUD组件中翻译。

我虽然这是因为这是一个管理员提供的管理员和我写的管理员,但我也集成了 SonataUserBundle ,并且这些管理员被翻译得很好(使用我&# 39; m假设sonata.admin.label.strategy.native策略,根据this是默认值并应生成人类可读的标签)

以下是该问题的说明:

Screenshot of un-translated labels

另一个显示,通过包含SonataUserBundle,管理员旁边的翻译仍然无法正常工作。

Screenshot of un-translated labels on the dashboard

如果您需要查看其他内容,请与我们联系。

有关版本信息,请参阅 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

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:1)

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