示例#1
0
 public function getCheckBox()
 {
     $this->mustBeKnownMessage();
     global $wgTranslateDocumentationLanguageCode;
     $placeholder = Html::element('div', array('class' => 'mw-translate-messagechecks'));
     $page = $this->handle->getKey();
     $translation = $this->getTranslation();
     $code = $this->handle->getCode();
     $en = $this->getDefinition();
     if (strval($translation) === '') {
         return $placeholder;
     }
     if ($code === $wgTranslateDocumentationLanguageCode) {
         return null;
     }
     $checker = $this->group->getChecker();
     if (!$checker) {
         return null;
     }
     $message = new FatMessage($page, $en);
     // Take the contents from edit field as a translation
     $message->setTranslation($translation);
     $checks = $checker->checkMessage($message, $code);
     if (!count($checks)) {
         return $placeholder;
     }
     $checkMessages = array();
     foreach ($checks as $checkParams) {
         array_splice($checkParams, 1, 0, 'parseinline');
         $checkMessages[] = call_user_func_array('wfMsgExt', $checkParams);
     }
     return Html::rawElement('div', array('class' => 'mw-translate-messagechecks'), TranslateUtils::fieldset(wfMsgHtml('translate-edit-warnings'), implode('<hr />', $checkMessages), array('class' => 'mw-sp-translate-edit-warnings')));
 }