当前位置: 首页>>代码示例>>PHP>>正文


PHP MessageCatalogue::getResources方法代码示例

本文整理汇总了PHP中Symfony\Component\Translation\MessageCatalogue::getResources方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageCatalogue::getResources方法的具体用法?PHP MessageCatalogue::getResources怎么用?PHP MessageCatalogue::getResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Translation\MessageCatalogue的用法示例。


在下文中一共展示了MessageCatalogue::getResources方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeCacheCatalogue

    /**
     * Initialize filerev catalogue from cache
     * or generate cache if not already available
     */
    private function initializeCacheCatalogue()
    {
        if (isset($this->catalogue)) {
            return;
        }
        $debug = $this->container->getParameter('grunt.debug');
        $cache = new ConfigCache($this->getCatalogueCachePath(), $debug);
        if (!$cache->isFresh()) {
            $this->initializeCatalogue();
            $content = sprintf(<<<EOF
<?php

use Symfony\\Component\\Translation\\MessageCatalogue;

\$catalogue = new MessageCatalogue(null, %s);

return \$catalogue;

EOF
, var_export($this->catalogue->all(), true));
            $cache->write($content, $this->catalogue->getResources());
            return;
        }
        $this->catalogue = (include $cache);
    }
开发者ID:kuborgh-xalejado,项目名称:generator-grunt-symfony,代码行数:29,代码来源:FilerevPackageInjector.php

示例2: initializeCacheCatalogue

    /**
     * Initialize filerev catalogue from cache
     * or generate cache if not already available
     */
    protected function initializeCacheCatalogue()
    {
        if (isset($this->summary)) {
            return;
        }
        $cache = new ConfigCache($this->getCatalogueCachePath($this->cacheDir), $this->debug);
        if (!$cache->isFresh()) {
            $this->initializeCatalogue($this->summaryFile);
            $content = sprintf(<<<EOF
<?php

use Symfony\\Component\\Translation\\MessageCatalogue;

\$catalogue = new MessageCatalogue(null, %s);

return \$catalogue;

EOF
, var_export($this->summary->all(), true));
            $cache->write($content, $this->summary->getResources());
            return;
        }
        $this->summary = (include $cache);
    }
开发者ID:kuborgh-bzoerb,项目名称:FilerevBundle,代码行数:28,代码来源:JsonVersionStrategy.php

示例3: testGetAddResource

 public function testGetAddResource()
 {
     $catalogue = new MessageCatalogue('en');
     $r = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
     $catalogue->addResource($r);
     $catalogue->addResource($r);
     $r1 = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
     $catalogue->addResource($r1);
     $this->assertEquals(array($r, $r1), $catalogue->getResources());
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:12,代码来源:MessageCatalogueTest.php

示例4: filterCatalogue

 private function filterCatalogue(MessageCatalogue $catalogue, $domain)
 {
     $filteredCatalogue = new MessageCatalogue($catalogue->getLocale());
     if ($messages = $catalogue->all($domain)) {
         $filteredCatalogue->add($messages, $domain);
     }
     foreach ($catalogue->getResources() as $resource) {
         $filteredCatalogue->addResource($resource);
     }
     if ($metadata = $catalogue->getMetadata('', $domain)) {
         foreach ($metadata as $k => $v) {
             $filteredCatalogue->setMetadata($k, $v, $domain);
         }
     }
     return $filteredCatalogue;
 }
开发者ID:yceruto,项目名称:symfony,代码行数:16,代码来源:TranslationUpdateCommand.php

示例5: getMatchedResources

    /**
     * Gets the resources that matches a domain and a locale on a particular catalog
     *
     * @param MessageCatalogue $catalog the catalog
     * @param string $domain the domain name (default is 'messages')
     * @param string $locae the locale, to filter fallbackLocale
     * @return array of FileResource objects
     */
    private function getMatchedResources(MessageCatalogue $catalog, $domain, $locale)
    {
        $matched = array();
        foreach ($catalog->getResources() as $resource) {

            // @see Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
            // filename is domain.locale.format
            $basename = \basename($resource->getResource());
            list($resourceDomain, $resourceLocale, $format) = explode('.', $basename);

            if ($domain === $resourceDomain && $locale === $resourceLocale) {
                $matched[] = $resource;
            }
        }

        return $matched;
    }
开发者ID:Gladhon,项目名称:TranslatorBundle,代码行数:25,代码来源:Translator.php

示例6: testGetAddResource

 public function testGetAddResource()
 {
     if (!class_exists('Symfony\\Component\\Config\\Loader\\Loader')) {
         $this->markTestSkipped('The "Config" component is not available');
     }
     $catalogue = new MessageCatalogue('en');
     $r = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
     $catalogue->addResource($r);
     $catalogue->addResource($r);
     $r1 = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
     $catalogue->addResource($r1);
     $this->assertEquals(array($r, $r1), $catalogue->getResources());
 }
开发者ID:laubosslink,项目名称:lab,代码行数:15,代码来源:MessageCatalogueTest.php


注:本文中的Symfony\Component\Translation\MessageCatalogue::getResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。