antfroger/dont-translate-bundle

此包已被废弃,不再维护。未建议替代包。

一个禁用 Symfony2 应用程序翻译并仅显示翻译键的包

v1.3.1 2016-10-27 14:48 UTC

This package is not auto-updated.

Last update: 2020-12-08 20:04:54 UTC


README

一个禁用 Symfony2 应用程序翻译并仅显示翻译键的包

Latest Stable Version SensioLabsInsight Scrutinizer Code Quality Code Coverage Build Status

安装

1. 使用 composer 添加所需包。

composer require antfroger/dont-translate-bundle

2. 将包添加到您的 AppKernel。

<?php
// in %kernel.root_dir%/AppKernel.php
$bundles[] = new Af\Bundle\DontTranslateBundle\AfDontTranslateBundle();

3. 可选,定义配置

  • 模式:您想使用的启用功能模式(get,cookie)
  • 参数名:您使用的启用功能的参数名称
  • 角色:用户至少应拥有这些角色之一才能启用功能;如果没有定义角色,用户无需登录即可启用功能
# app/config/config.ym
af_dont_translate:
    mode: "get"
    param_name: "untrans"
    roles: ["ROLE_ADMIN", "ROLE_TRANSLATOR"]

使用

要显示未翻译的应用程序,请将 GET 参数 param_name 添加到 URL 中

http://my-application.io/?untrans

或添加一个 param_name cookie 以仅查看应用程序中的翻译键

许可

此库采用 MIT 许可证。有关完整的版权和许可信息,请参阅与源代码一起分发的 LICENSE 文件。