예제 #1
0
파일: extract-l10n.php 프로젝트: njchw/mvp
        }
        return;
        // Disabled translation
    }
    $newTranslations[$id] = html_entity_decode($string);
}
if ($isMarkdown) {
    // Read markdown file
    $markdown = file_get_contents($target);
    // Render markdown as html
    $parsedown = new ParsedownExtra();
    $html = $parsedown->text($markdown);
    $html = str_replace('⌘', '⌘', $html);
    // Process html
    $l10n->set_domain($captureDomain);
    $l10n->translate_html($html, 'capture_translation');
} else {
    chdir('..');
    $_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__);
    define('HTML_I18N', 1);
    // Do not start output buffering twice
    ob_start(function ($input) use($l10n) {
        $l10n->translate_html($input, 'capture_translation');
        return '';
    });
    // Include target file
    include $target;
    ob_end_flush();
    // Add page title to translations
    if (!empty($page['title'])) {
        capture_translation($page['title'], $captureDomain, $page['title']);