當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Translator::__construct方法代碼示例

本文整理匯總了PHP中Symfony\Bundle\FrameworkBundle\Translation\Translator::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translator::__construct方法的具體用法?PHP Translator::__construct怎麽用?PHP Translator::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bundle\FrameworkBundle\Translation\Translator的用法示例。


在下文中一共展示了Translator::__construct方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor.
  *
  * Available options:
  *
  *   * cache_dir: The cache directory (or null to disable caching)
  *   * debug:     Whether to enable debugging or not (false by default)
  *   * resource_files: List of translation resources available grouped by locale.
  *
  * @param ContainerInterface $container A ContainerInterface instance
  * @param MessageSelector $selector The message selector for pluralization
  * @param array $loaderIds An array of loader Ids
  * @param array $options An array of options
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = [], array $options = [])
 {
     $domains = $resources = [];
     foreach ($options['resource_files'] as $locale => $files) {
         foreach ($files as $file) {
             if (preg_match('!([^.]+)\\.([^.]+)\\.[^\\.]+$!', basename($file), $a)) {
                 $resources[] = $file;
                 $domains[] = $a[1];
             }
         }
     }
     try {
         $locales = $container->get('octava_mui.locale_manager')->getAllAliases();
         foreach ($domains as $domain) {
             foreach ($locales as $locale) {
                 if (empty($options['resource_files'][$locale])) {
                     $options['resource_files'][$locale] = [];
                 }
                 $options['resource_files'][$locale][] = $domain . '.' . $locale . '.zdb';
             }
         }
     } catch (DBALException $e) {
         //for unit test, if cache empty and db scheme not created
     }
     $this->resources = $options['resource_files'];
     parent::__construct($container, $selector, $loaderIds, $options);
 }
開發者ID:octava,項目名稱:cms,代碼行數:43,代碼來源:Translator.php

示例2: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = [], array $options = [])
 {
     $this->selector = $selector;
     $this->themeRepository = $container->get('sylius.theme.repository');
     $this->themeContext = $container->get('sylius.theme.context');
     $this->resourcesToThemes = new ArrayCollection();
     parent::__construct($container, $selector, $loaderIds, $options);
 }
開發者ID:liverbool,項目名稱:dos-theme-bundle,代碼行數:11,代碼來源:Translator.php

示例3: __construct

 public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = array(), array $options = array())
 {
     parent::__construct($container, $selector, $loaderIds, $options);
     $this->memcached = $container->get('php.memcache');
 }
開發者ID:scottstuff,項目名稱:GCProtractorJS,代碼行數:5,代碼來源:Translator.php

示例4: __construct

 /**
  * {@inheritdoc}
  *
  * @api
  */
 public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = [], array $options = [])
 {
     parent::__construct($container, $selector, $loaderIds, $options);
     $this->selector = $selector;
     $this->container = $container;
 }
開發者ID:victoire,項目名稱:victoire,代碼行數:11,代碼來源:Translator.php

示例5: __construct

 /**
  * Constructor.
  *
  * Available options:
  *
  *   * cache_dir: The cache directory (or null to disable caching)
  *   * debug:     Whether to enable debugging or not (false by default)
  *   * resource_files: List of translation resources available grouped by locale.
  *
  * @param ContainerInterface $container A ContainerInterface instance
  * @param MessageSelector    $selector  The message selector for pluralization
  * @param array              $loaderIds An array of loader Ids
  * @param array              $options   An array of options
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = array(), array $options = array())
 {
     $options['resource_files'] = $container->get('graviton.18n.cacheutils')->getResources($options['resource_files']);
     parent::__construct($container, $selector, $loaderIds, $options);
 }
開發者ID:alebon,項目名稱:graviton,代碼行數:21,代碼來源:Translator.php


注:本文中的Symfony\Bundle\FrameworkBundle\Translation\Translator::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。