當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。