Skip to content

Commit

Permalink
bug #30921 [Translator] Warm up the translations cache in dev (tgalopin)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

[Translator] Warm up the translations cache in dev

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR fixes a bug in development when using the DataCollectorTranslator: because it's not implementing WarmableInterface, the translations cache is not built during cache:clear during development.

Commits
-------

a5f1afc [Translator] Warm up the translations cache in dev
  • Loading branch information
fabpot committed Apr 6, 2019
2 parents ed1b95d + a5f1afc commit 3e0b235
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Symfony/Component/Translation/DataCollectorTranslator.php
Expand Up @@ -11,12 +11,13 @@

namespace Symfony\Component\Translation;

use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
use Symfony\Component\Translation\Exception\InvalidArgumentException;

/**
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
*/
class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface
class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface, WarmableInterface
{
const MESSAGE_DEFINED = 0;
const MESSAGE_MISSING = 1;
Expand Down Expand Up @@ -87,6 +88,14 @@ public function getCatalogue($locale = null)
return $this->translator->getCatalogue($locale);
}

/**
* {@inheritdoc}
*/
public function warmUp($cacheDir)
{
return $this->translator->warmUp($cacheDir);
}

/**
* Gets the fallback locales.
*
Expand Down

0 comments on commit 3e0b235

Please sign in to comment.