bleizstudio / translang-bundle
Ergonomic translation service (TransLang) and Twig extension (lang function & filter with domain-first signature) for Symfony 7 & 8.
Package info
gitlab.com/io.bleizstudio/translang-bundle
Type:symfony-bundle
pkg:composer/bleizstudio/translang-bundle
1.0.1
2026-12-03 10:51 UTC
Requires
- php: >=8.4
- symfony/config: ^7.0|^8.0
- symfony/dependency-injection: ^7.0|^8.0
- symfony/http-kernel: ^7.0|^8.0
- symfony/translation-contracts: ^3.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0|^12.0|^13.0
- twig/twig: ^3.14
Suggests
- twig/twig: To use the lang() Twig function and |lang filter
Provides
None
Conflicts
None
Replaces
None
README
BleizStudio TransLangBundle
Symfony 7 & 8 bundle providing:
TransLang: injectable service ($this->lang->get($domain, $key, $options, $locale)).TransLangExtension: Twig function and filterlangwith a domain-first signature (no need to write|trans({}, 'domain')).
Installation
composer require bleizstudio/translang-bundle
If Symfony Flex does not register the bundle automatically, add it to config/bundles.php:
BleizStudio\TransLangBundle\TransLangBundle::class => ['all' => true],
PHP Usage
use BleizStudio\TransLangBundle\Service\TransLang;
class MyService
{
public function __construct(
protected TransLang $lang,
) {
}
public function greet(string $name): string
{
return $this->lang->get('messages', 'user.welcome', ['%name%' => $name]);
}
}
Twig Usage
Function:
{{ lang('messages', 'action.save') }}
{{ lang('messages', 'user.welcome', {'%name%': name}) }}
Filter:
{{ 'action.save'|lang('messages') }}
{{ 'user.welcome'|lang('messages', {'%name%': name}) }}
Quality & Tests
vendor/bin/phpstan analyse
vendor/bin/phpunit
License
bleizstudio/translang-bundle is distributed under the GPL-3.0-or-later license. See LICENSE.