protected function compile($file,$path)
    {
        $results = array();

        // if .tmp file exists, clean it for further using it as cache
        if (file_exists("$path.tmp")) {
            unlink("$path.tmp");
        }
        $options = implode(' ',array(
            '--check',
            "-o $path.tmp",
            $file,
        ));

        $process = new Process('msgfmt '.$options);
        $process->run();
        $output = $process->getOutput();
        if (!$process->isSuccessful()) {
            throw new \Exception($process->getErrorOutput());
        }

        if (!file_exists("$path.tmp")) {
            throw new \Exception('msgfmt failed to compile messages for translating. Did you install gettext?');
        }
        rename("$path.tmp", $path);
        $results[$this->relative($file)] = 'Scanned';
        $results[$this->relative($path)] = 'Written';

        return $results;
    }