Exemple #1
0
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
require_once dirname(__FILE__) . '/../configuration/prepend.inc.php';
if (!isset($argv)) {
    exit;
}
QFirebug::setEnabled(false);
if (array_search('--help', $argv) !== false) {
    echo sprintf("php %s [options]\n" . "--user                       user id that will be used for the added translations\n" . "--project                    project id instead of importing all projects\n" . "--language                   language code instead of importing all languages\n" . "--disable-plugins            disable plugins during import/export\n" . "--do-not-clear-logs          doesn't clear the logs before starting\n" . "                             suggestions, optional, defaults to anonymous\n" . "--do-not-check-equal         don't check if the translation is equal to the original\n" . "                             text and don't import it\n" . "--skip-untranslated          skip likes that don't have translated texts\n" . "--approve                    approve the imported suggestions\n" . "--approve-already-approved   overwrite translations approved in Narro\n" . "--import-unchanged-files     import files marked unchanged after the last import\n" . "--only-suggestions           import only suggestions, don't add files, texts\n" . "                             or contexts\n" . "--no-suggestions             do not import suggestions\n", basename(__FILE__), NarroLanguage::SOURCE_LANGUAGE_CODE);
    exit;
}
$intProjCnt = NarroProject::CountByActive(1);
$intLangCnt = NarroLanguage::CountAllActive();
if (!in_array('--do-not-clear-logs', $argv)) {
    NarroLog::Truncate();
}
$intStartTime = time();
foreach (NarroProject::LoadArrayByActive(1) as $intProjIdx => $objProject) {
    if (in_array('--project', $argv) && $objProject->ProjectId != $argv[array_search('--project', $argv) + 1]) {
        continue;
    }
    foreach (NarroLanguage::LoadAllActive() as $intLangIdx => $objLanguage) {
        if (in_array('--language', $argv) && $objLanguage->LanguageCode != $argv[array_search('--language', $argv) + 1]) {
            continue;
        }
        if (in_array('--progress', $argv)) {
            $strProjectProgress = '';