protected function groupSelector() { $activeId = false; if ($this->group) { $activeId = $this->group->getId(); } $groups = MessageGroups::getAllGroups(); $dynamic = MessageGroups::getDynamicGroups(); $groups = array_keys(array_merge($groups, $dynamic)); $selected = $this->options['group']; $selector = new XmlSelect('group', 'group'); $selector->setDefault($selected); foreach ($groups as $id) { if ($id === $activeId) { $activeId = false; } $group = MessageGroups::getGroup($id); $hide = MessageGroups::getPriority($group) === 'discouraged'; if (!$group->exists() || $hide) { continue; } $selector->addOption($group->getLabel(), $id); } if ($activeId) { $selector->addOption($this->group->getLabel(), $activeId); } return $selector->getHTML(); }
public function getDefinitionBox() { $this->mustHaveDefinition(); $en = $this->getDefinition(); $title = Linker::link(SpecialPage::getTitleFor('Translate'), htmlspecialchars($this->group->getLabel()), array(), array('group' => $this->group->getId(), 'language' => $this->handle->getCode())); $label = wfMessage('translate-edit-definition')->text() . wfMessage('word-separator')->text() . wfMessage('parentheses', $title)->text(); // Source language object $sl = Language::factory($this->group->getSourceLanguage()); $dialogID = $this->dialogID(); $id = Sanitizer::escapeId("def-{$dialogID}"); $msg = $this->adder($id, $sl) . "\n" . Html::rawElement('div', array('class' => 'mw-translate-edit-deftext', 'dir' => $sl->getDir(), 'lang' => $sl->getCode()), TranslateUtils::convertWhiteSpaceToHTML($en)); $msg .= $this->wrapInsert($id, $en); $class = array('class' => 'mw-sp-translate-edit-definition mw-translate-edit-definition'); return TranslateUtils::fieldset($label, $msg, $class); }
/** * Use the newFromContext() function rather than the constructor directly * to construct the object to allow alternative implementations. */ public function __construct(MessageCollection $collection, MessageGroup $group) { $this->collection = $collection; $this->group = $group; $this->setHeaderText('table', $group->getLabel()); }
public function __construct( MessageCollection $collection, MessageGroup $group ) { $this->collection = $collection; $this->group = $group; $this->setHeaderText( 'table', $group->getLabel() ); $this->appendEditLinkParams( 'loadgroup', $group->getId() ); }
/** * Gets the name of group with some extra formatting. * @param $group MessageGroup * @return string Html */ public function getGroupLabel( MessageGroup $group ) { $groupLabel = htmlspecialchars( $group->getLabel() ); // Bold for meta groups. if ( $group->isMeta() ) { $groupLabel = Html::rawElement( 'b', null, $groupLabel ); } return $groupLabel; }