do { $new_src = trim(ask("What is the new source?")); } while (!simple_prompt("Replace:\n\t{$old_src}\nto:\n\t{$new_src}")); if (simple_prompt("Would you like to preserve the existing translations in the .po files for the locales " . implode(",", array_keys($avail_locales)) . "?")) { foreach ($avail_locales as $avail_locale => $avail_locale_file) { I2CE::raiseError("Updateing {$lp_module}'s {$avail_locale}.po"); $loc_translations = loadPot($avail_locale_file); $top_module = $found_modules[$module]; $new_loc_translations = array(); foreach ($loc_translations as $key => $vals) { if ($key == $old_src) { $key = $new_src; } $new_loc_translations[$key] = $vals; } writeOutPOT($avail_locale_file, $top_module, $module, $module_vers, $new_loc_translations); } } $new_translations = array(); foreach ($old_translations as $key => $vals) { if ($key == $old_src) { $new_translations[$key] = $new_src; } else { $new_translations[$key] = $key; } } $change_template = null; if (array_key_exists($module, $templates)) { foreach ($templates[$module] as $basePath => $template_files) { //basePath ends in en_US; foreach ($template_files as $template_file) {
continue; } // if (file_exists($pot_file)) { // I2CE::raiseError("Removing $pot_file"); // if (!unlink($pot_file)) { // I2CE::raiseError( "Could not remove existing $launchpad_module.pot in $tpot_dir -- Skipping"); // continue; // } // } if ($meta) { //add back in the meta data if it exists if (array_key_exists('', $existing_template)) { array_unshift($meta, $existing_template['']); } } if (writeOutPOT($pot_file, $top_module, $module, $vers, $existing_template)) { I2CE::raiseError("Created {$pot_file} for {$module} {$vers}"); if (count($new_strings) > 0) { I2CE::raiseError("Have added " . count($new_strings) . " new string(s)"); } if (count($removed) > 0) { I2CE::raiseError("Removed " . count($removed) . " string(s)"); } } else { I2CE::raiseError("Failed to write out {$pot_file} for {$module}", E_USER_WARNING); } } function getConfigurationStrings($module, $config_dir, &$strings) { global $file; $config_file = null;