本文整理匯總了PHP中Symfony\Bundle\FrameworkBundle\Translation\Translator::addLoader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translator::addLoader方法的具體用法?PHP Translator::addLoader怎麽用?PHP Translator::addLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Bundle\FrameworkBundle\Translation\Translator
的用法示例。
在下文中一共展示了Translator::addLoader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct(Loader $loader, EventDispatcherInterface $eventDispatcher, Translator $translator)
{
$this->loader = $loader;
$this->eventDispatcher = $eventDispatcher;
$this->translator = $translator;
$translator->addLoader('array', new ArrayLoader());
}
示例2: addLoader
/**
* {@inheritdoc}
*/
public function addLoader($format, LoaderInterface $loader)
{
parent::addLoader($format, new Loader($loader, $this->resourcesToThemes));
}
示例3: addLoader
/**
* {@inheritdoc}
*/
public function addLoader($format, LoaderInterface $loader)
{
if (null !== $this->resourceCache) {
// wrap a resource loader by a caching loader to prevent loading of the same resource several times
// it strongly decreases a translation catalogue loading time
// for example a time of translation cache warming up is decreased in about 4 times
$loader = new CachingTranslationLoader($loader, $this->resourceCache);
}
parent::addLoader($format, $loader);
}