/** * Creates jobs needed to create or update all translation page definitions. * @param TranslatablePage $page * @param array $sections * @return Job[] * @since 2013-01-28 */ public static function getTranslationUnitJobs(TranslatablePage $page, array $sections) { $jobs = array(); $code = $page->getSourceLanguageCode(); $prefix = $page->getTitle()->getPrefixedText(); foreach ($sections as $s) { $unit = $s->name; $title = Title::makeTitle(NS_TRANSLATIONS, "{$prefix}/{$unit}/{$code}"); $fuzzy = $s->type === 'changed'; $jobs[] = MessageUpdateJob::newJob($title, $s->getTextWithVariables(), $fuzzy); } return $jobs; }