Example #1
0
                $resline['text'] = substr($resline['text'], 1);
            }
            $res = trim($resline['text']);
        }
        $resultsx[$resline['index']] = $res;
    }
    // Return an array contains all editable texts and their positions in file contents
    return $resultsx;
}
function isLiteral($text)
{
    // ToDo check if text is literal and don't need to be translated
    return false;
}
//------- Locate file according to the selected path
$status = getTranslationStatus($file);
switch ($source) {
    case 'upath':
        // User cached path
        $file = $user['cache'] . getCacheName($file);
        break;
    case 'apath':
        // File from translation
        $file = $translationPath . $file;
        break;
    case 'epath':
        // English source
        $file = CVS_ROOT_PATH . 'en/' . $file;
        break;
    case 'diff':
        // cvs diff
Example #2
0
function printFiles($files, $path)
{
    global $translationPath, $user;
    sort($files);
    foreach ($files as $fl) {
        $status = getTranslationStatus($path . $fl);
        if ($status['translated']) {
            if ($status['fileEnRevision'] && $status['lastEnRevision'] && $status['distance'] >= 0) {
                if (!$status['backward']) {
                    $title = 'Up to date';
                    $img = 'images/up2date.png';
                } else {
                    $title = 'Outdated ' . $status['fileEnRevision'] . ' / ' . $status['lastEnRevision'];
                    $img = 'images/r' . ($status['backward'] + 1) . '.png';
                }
            } else {
                $title = 'EN-Revision is incorrect or missing';
                $img = 'images/unknown.png';
            }
        } else {
            $title = 'Not translated yet';
            $img = 'images/notyet.png';
        }
        print "<a href='?path={$path}&file={$fl}' target=fileframe><img src='images/text.png' width=16 height=16 border=0 align=absmiddle> {$fl}</a> <img src='{$img}' border=0 align=absmiddle alt='{$title}'><br>";
    }
    // Lists the user's cached files
    if (file_exists($user['cache'] . "files.txt")) {
        print '<hr>';
        print 'Cached files:<br>';
        $ff = file($user['cache'] . "files.txt");
        foreach ($ff as $f) {
            $fx = explode('|', $f);
            if (!isset($cf[$fx[2]])) {
                print "<a href='editxml.php?file={$fx['2']}&source=upath' target=fileframe>{$fx['2']}</a><br>";
                $cf[$fx[2]] = true;
            }
        }
    }
}