Skip to content

Commit

Permalink
Implement new interfaces from symfony/translation-contracts (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude authored Feb 1, 2022
1 parent 45c7266 commit f910c37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lock-symfony-version.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

cat <<< $(jq --arg version $VERSION '.require |= with_entries(if ((.key|test("^symfony/monolog")|not) and (.key|test("^symfony/"))) then .value=$version else . end)' < composer.json) > composer.json
cat <<< $(jq --arg version $VERSION '.require |= with_entries(if ((.key|test("^symfony/translation-contracts")|not) and (.key|test("^symfony/"))) then .value=$version else . end)' < composer.json) > composer.json
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
"symfony/config": "^3.4.31|^4.0",
"symfony/dependency-injection": "^3.4.31|^4.0",
"symfony/finder": "^3.4.31|^4.0",
"symfony/framework-bundle": "^4.4",
"symfony/http-kernel": "^3.4.31|^4.0",
"symfony/translation": "^3.4.31|^4.0",
"symfony/translation": "^4.2",
"symfony/translation-contracts": "^1.0.2|^2.0|^3.0",
"twig/twig": "^1.42|^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5 | ^9.0",
"symfony/framework-bundle": "^3.4.31|^4.0",
"symfony/monolog-bundle": "^3.4.31|^4.0",
"symfony/phpunit-bridge": "> 5.0",
"symfony/twig-bundle": "^3.4.31|^4.0",
Expand Down
11 changes: 6 additions & 5 deletions src/Translator/FormatterDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,35 @@

namespace Webfactory\IcuTranslationBundle\Translator;

use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface;

/**
* Decorates a Symfony translator and adds support for message formatting.
*/
class FormatterDecorator implements TranslatorInterface
class FormatterDecorator implements LegacyTranslatorInterface, TranslatorInterface
{
/**
* The inner translator.
*
* @var \Symfony\Component\Translation\TranslatorInterface
*/
protected $translator = null;
protected $translator;

/**
* The formatter that is used to apply message transformations.
*
* @var \Webfactory\IcuTranslationBundle\Translator\Formatting\IntlFormatter
*/
protected $formatter = null;
protected $formatter;

/**
* Creates a decorator for the provided translator.
*
* @param \Webfactory\IcuTranslationBundle\Translator\Formatting\FormatterInterface the formatter that is used
*/
public function __construct(TranslatorInterface $translator, FormatterInterface $formatter)
public function __construct(LegacyTranslatorInterface $translator, FormatterInterface $formatter)
{
$this->translator = $translator;
$this->formatter = $formatter;
Expand Down

0 comments on commit f910c37

Please sign in to comment.