$templates_dir = "." . DIRECTORY_SEPARATOR . "translations" . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
$set_configs = false;
require_once "translate_base.php";
$templates = getTranslatableDocuments(false);
$configs = getTranslatableConfigs(false);
foreach (array_keys($found_modules) as $module) {
    if ((!array_key_exists($module, $templates) || !is_array($templates[$module])) && (!array_key_exists($module, $configs) || !$configs[$module])) {
        I2CE::raiseError("No translatable templates or configs for {$module}");
        continue;
    }
    $lp_modules[] = launchpad($module);
    $modules[] = $module;
}
ksort($modules);
do {
    $idx = chooseMenuIndex("Which module would you like to fixup a english source text for?", $lp_modules);
    $module = $modules[$idx];
    $lp_module = $lp_modules[$idx];
    if ((!array_key_exists($module, $templates) || !is_array($templates[$module])) && (!array_key_exists($module, $configs) || !$configs[$module])) {
        I2CE::raiseError("No translatable templates or configs for {$module}");
        continue;
    }
    $template_dir = $templates_dir . $lp_module . DIRECTORY_SEPARATOR;
    $module_vers = '';
    I2CE::getConfig()->setIfIsSet($module_vers, "/config/data/{$module}/version");
    if (strlen($module_vers) == 0) {
        I2CE::raiseError("No module version found -- Skipping");
        continue;
    }
    $avail_locales = array();
    foreach (glob($template_dir . '*.po') as $avail_locale) {
Exemplo n.º 2
0
function chooseMenuValue($msg, $options)
{
    return $options[chooseMenuIndex($msg, $options)];
}
Exemplo n.º 3
0
        } else {
            if (prompt("Get all unreleaseed revisions for " . basename($dir) . "?", $all_revisions)) {
                array_unshift($t_releases, array($last_revno, 'current'));
                list($revno, $release) = $t_releases[0];
                //maximum release is the first entry
            } else {
                $logs = $options = array();
                $nextrev = $revno + 1;
                $cmd = "bzr log --line -r {$nextrev}.. {$dir}";
                foreach (explode("\n", shell_exec($cmd)) as $log) {
                    if (!preg_match('/^([0-9]+):(.*)$/', $log, $matches)) {
                        continue;
                    }
                    $options[$matches[1]] = trim($matches[2]);
                }
                $last_revno = chooseMenuIndex("Which revision do you want to package to?", $options);
                array_unshift($t_releases, array($last_revno, 'current'));
                list($revno, $release) = $t_releases[0];
                //maximum release is the first entry
            }
            I2CE::raiseError("Warning: The last revision {$last_revno} of {$dir} has not been tagged as a release. Will postfix the revision count to all modified modules");
        }
    }
    $version_components = array_pad(explode(".", $version), 3, 0);
    $sub_major_version = implode(".", array_slice($version_components, 0, 2));
    $minor_version = implode(".", array_slice($version_components, 0, 3));
    if ($release && $minor_version != $release) {
        I2CE::raiseError("Warning module version  at " . basename($dir) . " has {$minor_version} != " . $release . ', the tagged release version');
    }
    $releases[$module] = array('dir' => basename($dir), 'releases' => $t_releases, 'revno' => $last_revno, 'commit_revno' => $last_commit_revno, 'tagged_revno' => $tagged_revno, 'release' => $release, 'previous_release' => $prev_release, 'previous_revno' => $prev_revno, 'version' => $version, 'sub_major_version' => $sub_major_version, 'minor_version' => $minor_version, 'sites' => glob("{$dir}/sites/*", GLOB_ONLYDIR));
}
Exemplo n.º 4
0
        if (substr($file_ext, 0, 3) == 'xls') {
            $data_file = new ExcelDataFile($file);
        } else {
            $xml_file = $file;
        }
    }
}
if (!$xml_file || !$data_file) {
    usage("Please specify the name of a spreadsheet to process and an .xml data module to process");
}
$form = trim(ask("What form are you remapping?"));
$old_head = false;
$new_head = false;
$headers = $data_file->getHeaders();
$old_head = chooseMenuIndex("Please select the column with the old values that will be remapped from:", $headers);
$new_head = chooseMenuIndex("Please select the column with the new values that will be remapped to:", $headers);
$remaps = array();
while ($data_file->hasDataRow()) {
    if (!is_array($row = $data_file->getDataRow()) || !array_key_exists($old_head, $row) || !array_key_exists($new_head, $row)) {
        continue;
    }
    $remaps[trim(strtoupper($row[$old_head]))] = trim($row[$new_head]);
}
//print_r($remaps);
$template = new I2CE_MagicDataTemplate();
if (!$template->loadRootFile($xml_file)) {
    usage("You need to specify a data .xml file");
}
if (!($versionNodes = $template->query('//I2CEConfiguration/metadata/version')) instanceof DOMNodeList || !$versionNodes->length == 1) {
    usage("Could not find current version in data .xml file");
}