[TranslationDebug] workaround for getFallbackLocales.
This commit is contained in:
parent
7e53eab232
commit
31deea1d3d
@ -19,6 +19,8 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Translation\MessageCatalogue;
|
use Symfony\Component\Translation\MessageCatalogue;
|
||||||
use Symfony\Component\Translation\Translator;
|
use Symfony\Component\Translation\Translator;
|
||||||
|
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||||
|
use Symfony\Component\Translation\LoggingTranslator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helps finding unused or missing translation messages in a given locale
|
* Helps finding unused or missing translation messages in a given locale
|
||||||
@ -157,7 +159,7 @@ EOF
|
|||||||
// Load the fallback catalogues
|
// Load the fallback catalogues
|
||||||
$fallbackCatalogues = array();
|
$fallbackCatalogues = array();
|
||||||
$translator = $this->getContainer()->get('translator');
|
$translator = $this->getContainer()->get('translator');
|
||||||
if ($translator instanceof Translator) {
|
if ($translator instanceof Translator || $translator instanceof DataCollectorTranslator || $translator instanceof LoggingTranslator) {
|
||||||
foreach ($translator->getFallbackLocales() as $fallbackLocale) {
|
foreach ($translator->getFallbackLocales() as $fallbackLocale) {
|
||||||
if ($fallbackLocale === $locale) {
|
if ($fallbackLocale === $locale) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -88,6 +88,20 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
|||||||
return $this->translator->getCatalogue($locale);
|
return $this->translator->getCatalogue($locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fallback locales.
|
||||||
|
*
|
||||||
|
* @return array $locales The fallback locales
|
||||||
|
*/
|
||||||
|
public function getFallbackLocales()
|
||||||
|
{
|
||||||
|
if ($this->translator instanceof Translator) {
|
||||||
|
return $this->translator->getFallbackLocales();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passes through all unknown calls onto the translator object.
|
* Passes through all unknown calls onto the translator object.
|
||||||
*/
|
*/
|
||||||
|
@ -88,6 +88,20 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
|||||||
return $this->translator->getCatalogue($locale);
|
return $this->translator->getCatalogue($locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fallback locales.
|
||||||
|
*
|
||||||
|
* @return array $locales The fallback locales
|
||||||
|
*/
|
||||||
|
public function getFallbackLocales()
|
||||||
|
{
|
||||||
|
if ($this->translator instanceof Translator) {
|
||||||
|
return $this->translator->getFallbackLocales();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passes through all unknown calls onto the translator object.
|
* Passes through all unknown calls onto the translator object.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user