/** * Apply manual conversion rules. * * @param ConverterRule $convRule */ protected function applyManualConv($convRule) { // Use syntax -{T|zh-cn:TitleCN; zh-tw:TitleTw}- to custom // title conversion. // Bug 24072: $mConvRuleTitle was overwritten by other manual // rule(s) not for title, this breaks the title conversion. $newConvRuleTitle = $convRule->getTitle(); if ($newConvRuleTitle) { // So I add an empty check for getTitle() $this->mConvRuleTitle = $newConvRuleTitle; } // merge/remove manual conversion rules to/from global table $convTable = $convRule->getConvTable(); $action = $convRule->getRulesAction(); foreach ($convTable as $variant => $pair) { if (!$this->validateVariant($variant)) { continue; } if ($action == 'add') { // More efficient than array_merge(), about 2.5 times. foreach ($pair as $from => $to) { $this->mTables[$variant]->setPair($from, $to); } } elseif ($action == 'remove') { $this->mTables[$variant]->removeArray($pair); } } }