本文整理汇总了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);
}