当前位置: 首页>>代码示例>>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;未经允许,请勿转载。