コード例 #1
0
 function it_aggregates_the_unique_resources_locales(TranslatorResourceProviderInterface $firstResourceProvider, TranslatorResourceProviderInterface $secondResourceProvider)
 {
     $this->beConstructedWith([$firstResourceProvider, $secondResourceProvider]);
     $firstResourceProvider->getResourcesLocales()->willReturn(['first-locale']);
     $secondResourceProvider->getResourcesLocales()->willReturn(['second-locale', 'first-locale', 'second-locale']);
     $this->getResourcesLocales()->shouldReturn(['first-locale', 'second-locale']);
 }
コード例 #2
0
ファイル: Translator.php プロジェクト: ahmadrabie/Sylius
 private function addResources()
 {
     if ($this->resourcesLoaded) {
         return;
     }
     $resources = $this->resourceProvider->getResources();
     foreach ($resources as $resource) {
         $this->addResource($resource->getFormat(), $resource->getName(), $resource->getLocale(), $resource->getDomain());
     }
     $this->resourcesLoaded = true;
 }