protected function initializeFromTemplate($template, $languages)
    {
        $results = array();
        $target = dirname($template);
        if (!file_exists($template)) {
            throw new ResourceNotFoundException("Template not found in: $template\n\nRun 'app/console gettext:bundle:extract' first.");
        }
        $results[$this->relative($template)] = 'Scanned';
        $languages = explode(',', trim($languages));
        foreach ($languages as $lang) {
            $lang = trim($lang);
            $file = "$target/locale/$lang/LC_MESSAGES/messages.po";
            if (file_exists($file)) {
                $results[$this->relative($file)] = 'Skipped';
                continue;
            }
            if (!file_exists(dirname($file))) {
                mkdir(dirname($file), 0755, true);
            }
            $data = file_get_contents($template);
            $version = $this->relative($target . '/../..') . '@' . date('YmdHis');
            $data = preg_replace('/Project-Id-Version: PACKAGE VERSION\\\n/', 'Project-Id-Version: ' . $version . '\n', $data, 1);
            $data = preg_replace('/Language: \\\n/','Language: ' . $lang . '\n', $data, 1);
            $data = preg_replace('/charset=CHARSET/', 'charset=UTF-8', $data, 1);
            $status = file_put_contents($file, $data) ? 'Created' : 'Failed';
            $results[$this->relative($file)] = $status;
        }

        return $results;
    }