<?php

namespace GettextTranslator\DI;

use Nette;

if (!class_exists('Nette\DI\CompilerExtension'))
{
  class_alias('Nette\Config\CompilerExtension', 'Nette\DI\CompilerExtension');
}

class Extension extends Nette\DI\CompilerExtension
{

  /** @var array */
  private $defaults = array(
      'lang' => 'en',
      'files' => array(),
      'layout' => 'horizontal',
      'height' => 450
  );

  public function loadConfiguration()
  {
    $config = $this->getConfig($this->defaults);
    $builder = $this->getContainerBuilder();

    $translator = $builder->addDefinition($this->prefix('translator'));
    $translator->setClass('GettextTranslator\Gettext', array('@session', '@cacheStorage', '@httpResponse'));
    $translator->addSetup('setLang', array($config['lang']));
    $translator->addSetup('setProductionMode', array($builder->expand('%productionMode%')));

    // at least one language file must be defined
    if (count($config['files']) === 0)
    {
      throw new InvalidConfigException('Language file(s) must be defined.');
    }
    foreach ($config['files'] AS $id => $file)
    {
      $translator->addSetup('addFile', array($file, $id));
    }

    $translator->addSetup('GettextTranslator\Panel::register', array('@application', '@self', '@session', '@httpRequest', $config['layout'], $config['height']));
  }

}

class InvalidConfigException extends Nette\InvalidStateException
{
  
}

<?php

namespace GettextTranslator\DI;

use Nette\DI\CompilerExtension;
use Nette\DI\ContainerBuilder;

if (!class_exists('Nette\DI\CompilerExtension'))
{
  class_alias('Nette\Config\CompilerExtension', 'Nette\DI\CompilerExtension');
}

class Extension extends CompilerExtension
{
  /** @var array */
  private $defaults = array(
      'lang' => 'en',
      'files' => array(),
      'layout' => 'horizontal',
      'height' => 450
  );

  public function loadConfiguration()
  {
    $config = $this->getConfig($this->defaults);
    $builder = $this->getContainerBuilder();

    $translator = $builder->addDefinition($this->prefix('translator'));
    $translator->setClass('GettextTranslator\Gettext', array('@session', '@cacheStorage', '@httpResponse'));
    $translator->addSetup('setLang', array($config['lang']));
    $translator->addSetup('setProductionMode', array($builder->expand('%productionMode%')));

    foreach ($config['files'] AS $id => $file)
    {
      $translator->addSetup('addFile', array($file, $id));
    }

    $translator->addSetup('GettextTranslator\Panel::register', array('@application', '@self', '@session', '@httpRequest', $config['layout'], $config['height']));
  }

}

Remove check for translation files
Remove check for translation files

There is no reason why crash whole app when extension is not configured