Search by

bleizstudio / translang-bundle

Skryptar

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

Issues

Type:symfony-bundle

pkg:composer/bleizstudio/translang-bundle

Statistics

Installs: 21

Dependents: 0

Suggesters: 0

Stars: 0

1.0.1 2026-12-03 10:51 UTC

This package is auto-updated.

Last update: 2026-12-03 10:01:07 UTC


README

Pipeline Security PHPStan PHPUnit Lines of code

Version française

BleizStudio TransLangBundle

BleizStudio TransLangBundle

Symfony 7 & 8 bundle providing:

  • TransLang: injectable service ($this->lang->get($domain, $key, $options, $locale)).
  • TransLangExtension: Twig function and filter lang with 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.