qbbr/locale-configurator-bundle
最新稳定版本:1.0.6
Composer 安装命令:
composer require qbbr/locale-configurator-bundle
包简介
Simple configuration on locale
README 文档
README
Simple configuration on locale.
Installation
Step 1: Download the Bundle
composer require qbbr/locale-configurator-bundle
Step 2: Enable the Bundle
// config/bundles.php return [ // ... Qbbr\LocaleConfiguratorBundle\LocaleConfiguratorBundle::class => ['all' => true], ];
Configuration
Config structure
config/locale_configurator/
├── _default.yaml
├── en.yaml
├── ru.yaml
└── ...
logic: config = merge(_default.yaml, locale.yaml)
Parameters by default
u can override it.
parameters: qbbr.locale_configurator.config_dir: '%kernel.project_dir%/config/locale_configurator' qbbr.locale_configurator.raise_not_found_param_exception: false
Usage
PHP
use Qbbr\LocaleConfiguratorBundle\Configurator\LocaleConfigurator; class SomeService { private LocaleConfigurator $lc; public function __construct( LocaleConfigurator $lc ) { $this->lc = $lc; } public function something() { // $this->lc->setLocale('ru'); $param1 = $this->lc->get('param1'); } }
Twig
has lc_has/lc_get fn.
{% if lc_has('param1') %} ... {% endif %} {% set param1 = lc_get('param1') %}
Tests
./vendor/bin/phpunit Tests/ -v --testdox
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-27