8000 [Translation] [2.6] Upgrade information for LoggingTranslator by derrabus · Pull Request #12579 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Translation] [2.6] Upgrade information for LoggingTranslator #12579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions UPGRADE-2.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,43 @@ $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
Then enjoy dumping variables by calling `dump($var)` anywhere in your PHP
and `{% dump var %}` or `{{ dump(var) }}` in Twig. Dumps are displayed
**in the web debug toolbar**.

Translation
-----------

With `LoggingTranslator`, a new translator class is introduced with Symfony
2.6. By default, the `@translator` service is referring to this class in the
debug environment.

If you have own services that depend on the `@translator` service and expect
this service to be an instance of either
`Symfony\Component\Translation\Translator` or
`Symfony\Bundle\FrameworkBundle\Translation\Translator`, e.g. by type-hinting
for either of these classes, you will need to change that type hint. You can
use the `TranslatorInterface` to be on the safe side for future changes.

Before:

```php
use Symfony\Component\Translation\Translator;

class MyService {
public function __construct(Translator $translator)
{
...
}
}
```

After:

```php
use Symfony\Component\Translation\TranslatorInterface;

class MyService {
public function __construct(TranslatorInterface $translator)
{
...
}
}
```
0