sooyoos / php-translation-bundle
0.12.1
2020-02-25 16:44 UTC
Requires
- php: ^7.1
- nyholm/nsa: ^1.1
- php-translation/extractor: ^2.0
- php-translation/symfony-storage: ^2.1
- symfony/finder: ^3.4 || ^4.3 || ^5.0
- symfony/framework-bundle: ^3.4 || ^4.3 || ^5.0
- symfony/intl: ^3.4 || ^4.3 || ^5.0
- symfony/translation: ^3.4 || ^4.3 || ^5.0
- symfony/twig-bundle: ^3.4 || ^4.3 || ^5.0
- symfony/validator: ^3.4 || ^4.3 || ^5.0
- twig/twig: ^2.11 || ^3.0
Requires (Dev)
- matthiasnoback/symfony-config-test: ^4.1
- matthiasnoback/symfony-dependency-injection-test: ^4.1
- nyholm/psr7: ^1.1
- nyholm/symfony-bundle-test: ^1.6.1
- php-http/curl-client: ^1.7
- php-http/message: ^1.6
- php-http/message-factory: ^1.0.2
- php-translation/translator: ^1.0
- phpunit/phpunit: ^8.4
- symfony/asset: ^3.4 || ^4.3 || ^5.0
- symfony/console: ^3.4 || ^4.3 || ^5.0
- symfony/dependency-injection: ^3.4 || ^4.3 || ^5.0
- symfony/phpunit-bridge: ^4.4 || ^5.0
- symfony/twig-bridge: ^3.4 || ^4.3 || ^5.0
- symfony/web-profiler-bundle: ^3.4 || ^4.3 || ^5.0
Suggests
- php-http/httplug-bundle: To easier configure your httplug clients.
Conflicts
- symfony/config: <3.4.31
README
PHP翻译的Symfony集成
安装
通过Composer安装此包
$ composer require php-translation/symfony-bundle
如果您使用 Symfony Flex - 您已完成!Symfony Flex 会为您创建默认配置,如果需要可以更改它。如果您不使用 Symfony Flex,您需要执行几个更简单的步骤。
- 首先,注册此包
# config/bundles.php return [ // ... Translation\Bundle\TranslationBundle::class => ['all' => true], ];
- 然后,配置包。一个示例配置如下
# config/packages/php_translation.yaml translation: locales: ["en"] edit_in_place: enabled: false config_name: app configs: app: dirs: ["%kernel.project_dir%/templates", "%kernel.project_dir%/src"] output_dir: "%kernel.project_dir%/translations" excluded_names: ["*TestCase.php", "*Test.php"] excluded_dirs: [cache, data, logs]
# config/packages/dev/php_translation.yaml translation: symfony_profiler: enabled: true webui: enabled: true
- 最后一步,添加新路由
# config/routes/dev/php_translation.yaml _translation_webui: resource: "@TranslationBundle/Resources/config/routing_webui.yaml" prefix: /admin _translation_profiler: resource: '@TranslationBundle/Resources/config/routing_symfony_profiler.yaml'
# config/routes/php_translation.yaml _translation_edit_in_place: resource: '@TranslationBundle/Resources/config/routing_edit_in_place.yaml' prefix: /admin
文档
请参阅完整的文档:http://php-translation.readthedocs.io.