예제 #1
0
파일: extract-l10n.php 프로젝트: njchw/mvp
    exit('Bad page name.');
}
$target = __DIR__ . '/../' . $page['name'];
if ($isMarkdown) {
    $target .= '.md';
} else {
    $target .= '.php';
}
if (!file_exists($target)) {
    header('HTTP/1.0 404 Not Found');
    exit('Page not found.');
}
$l10n = new Translator('en');
// Extracted translations
$newTranslations = array();
$currentTranslations = $l10n->load_translations($captureDomain);
if ($currentTranslations === false) {
    $currentTranslations = array();
}
function capture_translation($id, $domain, $string)
{
    global $captureDomain, $newTranslations, $currentTranslations;
    if ($domain != $captureDomain) {
        return;
    }
    if (empty($id)) {
        return;
    }
    if (is_numeric($id) || ctype_punct($id)) {
        return;
        // Not supposed to be a translatable string