Example #1
0
 /**
  * Loads all strings for the language.
  *
  * @access  protected
  * @param   string     $language  Name of the language pack
  * @param   file       $file      File from which we are loading the strings
  */
 protected function loadStrings($language, $file)
 {
     if ($this->cache !== null) {
         if ($this->loadFromCache($language, $file)) {
             return;
         }
         $this->rebuildCache = true;
     }
     $this->strings[$language][$file] = $this->loader->loadStrings($language, $file);
 }
 /**
  *
  */
 public function testStringLoadingWithPackagesOverride()
 {
     $fileSystem = $this->getFileSystem();
     $fileSystem->shouldReceive('exists')->once()->with('/app/i18n/packages/foo/en_US/strings/foobar.php')->andReturn(true);
     $fileSystem->shouldReceive('exists')->never()->with('/app/packages/foo/i18n/en_US/strings/foobar.php')->andReturn(true);
     $fileSystem->shouldReceive('includeFile')->once()->with('/app/i18n/packages/foo/en_US/strings/foobar.php')->andReturn(['foo' => 'bar']);
     $loader = new Loader($fileSystem, '/app/i18n');
     $loader->registerNamespace('foo', '/app/packages/foo/i18n');
     $strings = $loader->loadStrings('en_US', 'foo::foobar');
     $this->assertEquals(['foo' => 'bar'], $strings);
 }