• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TranslateUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中TranslateUtils的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils类的具体用法?PHP TranslateUtils怎么用?PHP TranslateUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TranslateUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getMessageParameters

 public function getMessageParameters()
 {
     $params = parent::getMessageParameters();
     $type = $this->entry->getFullType();
     if ($type === 'translationreview/message') {
         $targetPage = $this->makePageLink($this->entry->getTarget(), array('oldid' => $params[3]));
         $params[2] = Message::rawParam($targetPage);
     } elseif ($type === 'translationreview/group') {
         /*
          * - 3: language code
          * - 4: label of the message group
          * - 5: old state
          * - 6: new state
          */
         $uiLanguage = $this->context->getLanguage();
         $language = $params[3];
         $targetPage = $this->makePageLinkWithText($this->entry->getTarget(), $params[4], array('language' => $language));
         $params[2] = Message::rawParam($targetPage);
         $params[3] = TranslateUtils::getLanguageName($language, $uiLanguage->getCode());
         $params[5] = $this->formatStateMessage($params[5]);
         $params[6] = $this->formatStateMessage($params[6]);
     } elseif ($type === 'translatorsandbox/rejected') {
         // No point linking to the user page which cannot have existed
         $params[2] = $this->entry->getTarget()->getText();
     } elseif ($type === 'translatorsandbox/promoted') {
         // Gender for the target
         $params[3] = User::newFromId($params[3])->getName();
     }
     return $params;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:TranslateLogFormatter.php


示例2: run

 function run()
 {
     // Initialization
     $title = $this->title;
     list(, $code) = TranslateUtils::figureMessage($title->getPrefixedText());
     // Return the actual translation page...
     $page = TranslatablePage::isTranslationPage($title);
     if (!$page) {
         var_dump($this->params);
         var_dump($title);
         throw new MWException("Oops, this should not happen!");
     }
     $group = $page->getMessageGroup();
     $collection = $group->initCollection($code);
     $text = $page->getParse()->getTranslationPageText($collection);
     // Other stuff
     $user = $this->getUser();
     $summary = $this->getSummary();
     $flags = $this->getFlags();
     $page = WikiPage::factory($title);
     // @todo FuzzyBot hack
     PageTranslationHooks::$allowTargetEdit = true;
     $content = ContentHandler::makeContent($text, $page->getTitle());
     $page->doEditContent($content, $summary, $flags, false, $user);
     PageTranslationHooks::$allowTargetEdit = false;
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:27,代码来源:TranslateRenderJob.php


示例3: toolboxAllTranslations

	/**
	 * Adds link in toolbox to Special:Prefixindex to show all other
	 * available translations for a message. Only shown when it
	 * actually is a translatable/translated message.
	 *
	 * @param $skin Skin
	 *
	 * @return bool
	 */
	static function toolboxAllTranslations( &$skin ) {
		global $wgTranslateMessageNamespaces;

		if ( method_exists( $skin, 'getSkin' ) ) {
			$title = $skin->getSkin()->getTitle();
		} else {
			global $wgTitle;
			$title = $wgTitle;
		}
		$ns = $title->getNamespace();
		if ( !in_array( $ns, $wgTranslateMessageNamespaces ) ) {
			return true;
		}

		$inMessageGroup = TranslateUtils::messageKeyToGroup( $title->getNamespace(), $title->getBaseText() );

		if ( $inMessageGroup ) {
			// Add a slash at the end, to not have basename in the result of Special:Prefixindex
			$message = $title->getNsText() . ":" . $title->getBaseText();
			$desc = wfMsg( 'translate-sidebar-alltrans' );
			$url = htmlspecialchars( SpecialPage::getTitleFor( 'Translations' )->getLocalURL( 'message=' . $message ) );

			// Add the actual toolbox entry.
			// Add newlines and tabs for nicer HTML output.
			echo( "\n\t\t\t\t<li id=\"t-alltrans\"><a href=\"$url\">$desc</a></li>\n" );
		}

		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:38,代码来源:ToolBox.php


示例4: execute

 public function execute()
 {
     $groupIds = explode(',', trim($this->getOption('group')));
     $groupIds = MessageGroups::expandWildcards($groupIds);
     $groups = MessageGroups::getGroupsById($groupIds);
     if (!count($groups)) {
         $this->error("ESG2: No valid message groups identified.", 1);
     }
     $start = $this->getOption('start') ? strtotime($this->getOption('start')) : false;
     $end = $this->getOption('end') ? strtotime($this->getOption('end')) : false;
     $this->output("Conflict times: " . wfTimestamp(TS_ISO_8601, $start) . " - " . wfTimestamp(TS_ISO_8601, $end) . "\n");
     $codes = array_filter(array_map('trim', explode(',', $this->getOption('lang'))));
     $supportedCodes = array_keys(TranslateUtils::getLanguageNames('en'));
     ksort($supportedCodes);
     if ($codes[0] === '*') {
         $codes = $supportedCodes;
     }
     /** @var FileBasedMessageGroup $group */
     foreach ($groups as $groupId => &$group) {
         if ($group->isMeta()) {
             $this->output("Skipping meta message group {$groupId}.\n");
             continue;
         }
         $this->output("{$group->getLabel()} ", $group);
         foreach ($codes as $code) {
             // No sync possible for unsupported language codes.
             if (!in_array($code, $supportedCodes)) {
                 $this->output("Unsupported code " . $code . ": skipping.\n");
                 continue;
             }
             $file = $group->getSourceFilePath($code);
             if (!$file) {
                 continue;
             }
             if (!file_exists($file)) {
                 continue;
             }
             $cs = new ChangeSyncer($group, $this);
             $cs->setProgressCallback(array($this, 'myOutput'));
             $cs->interactive = !$this->hasOption('noask');
             $cs->nocolor = $this->hasOption('nocolor');
             $cs->norc = $this->hasOption('norc');
             # @todo FIXME: Make this auto detect.
             # Guess last modified date of the file from either git, svn or filesystem
             if ($this->hasOption('git')) {
                 $ts = $cs->getTimestampsFromGit($file);
             } else {
                 $ts = $cs->getTimestampsFromSvn($file);
             }
             if (!$ts) {
                 $ts = $cs->getTimestampsFromFs($file);
             }
             $this->output("Modify time for {$code}: " . wfTimestamp(TS_ISO_8601, $ts) . "\n");
             $cs->checkConflicts($code, $start, $end, $ts);
         }
         unset($group);
     }
     // Print timestamp if the user wants to store it
     $this->output(wfTimestamp(TS_RFC2822) . "\n");
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:60,代码来源:sync-group.php


示例5: getForm

	/**
	 * Returns HTML5 output of the form
	 * GLOBALS: $wgLang, $wgScript
	 * @return string
	 */
	protected function getForm() {
		global $wgLang, $wgScript;

		$form = Xml::tags( 'form',
			array(
				'action' => $wgScript,
				'method' => 'get'
			),

			'<table><tr><td>' .
				wfMsgHtml( 'translate-page-language' ) .
			'</td><td>' .
				TranslateUtils::languageSelector( $wgLang->getCode(), $this->options['language'] ) .
			'</td></tr><tr><td>' .
				wfMsgHtml( 'translate-magic-module' ) .
			'</td><td>' .
				$this->moduleSelector( $this->options['module'] ) .
			'</td></tr><tr><td colspan="2">' .
				Xml::submitButton( wfMsg( 'translate-magic-submit' ) ) . ' ' .
				Xml::submitButton( wfMsg( 'translate-magic-cm-export' ), array( 'name' => 'export' ) ) .
			'</td></tr></table>' .
			Html::hidden( 'title', $this->getTitle()->getPrefixedText() )
		);
		return $form;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:SpecialMagic.php


示例6: testTokenRetrieval

 /** @dataProvider provideTokenClasses */
 public function testTokenRetrieval($id, $class)
 {
     // Make sure we have the right to get the token
     global $wgGroupPermissions;
     $wgGroupPermissions['*'][$class::getRight()] = true;
     RequestContext::getMain()->getUser()->clearInstanceCache();
     // Reread above global
     // We should be getting anonymous user token
     $expected = $class::getToken();
     $this->assertNotSame(false, $expected, 'We did not get a valid token');
     $actionString = TranslateUtils::getTokenAction($id);
     $params = wfCgiToArray($actionString);
     $req = new FauxRequest($params);
     $api = new ApiMain($req);
     $api->execute();
     if (defined('ApiResult::META_CONTENT')) {
         $data = $api->getResult()->getResultData(null, array('Strip' => 'all'));
     } else {
         $data = $api->getResultData();
     }
     if (isset($data['query'])) {
         foreach ($data['query']['pages'] as $page) {
             $this->assertSame($expected, $page[$id . 'token']);
         }
     } else {
         $this->assertArrayHasKey('tokens', $data, 'Result has tokens');
         $this->assertSame($expected, $data['tokens'][$id . 'token']);
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:ApiTokensTest.php


示例7: getDefinitions

 public function getDefinitions()
 {
     $groups = MessageGroups::getAllGroups();
     $keys = array();
     /**
      * @var $g MessageGroup
      */
     foreach ($groups as $g) {
         $states = $g->getMessageGroupStates()->getStates();
         foreach (array_keys($states) as $state) {
             $keys["Translate-workflow-state-{$state}"] = $state;
         }
     }
     $defs = TranslateUtils::getContents(array_keys($keys), $this->getNamespace());
     foreach ($keys as $key => $state) {
         if (!isset($defs[$key])) {
             // @todo Use jobqueue
             $title = Title::makeTitleSafe($this->getNamespace(), $key);
             $page = new WikiPage($title);
             $content = ContentHandler::makeContent($state, $title);
             $page->doEditContent($content, wfMessage('translate-workflow-autocreated-summary', $state)->inContentLanguage()->text(), 0, false, FuzzyBot::getUser());
         } else {
             // Use the wiki translation as definition if available.
             // getContents returns array( content, last author )
             list($content, ) = $defs[$key];
             $keys[$key] = $content;
         }
     }
     return $keys;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:WorkflowStatesMessageGroup.php


示例8: doHeader

	protected function doHeader( MessageCollection $collection ) {
		global $wgSitename, $wgTranslateDocumentationLanguageCode;

		$code = $collection->code;
		$name = TranslateUtils::getLanguageName( $code );
		$native = TranslateUtils::getLanguageName( $code, true );

		if ( $wgTranslateDocumentationLanguageCode ) {
			$docu = "\n * See the $wgTranslateDocumentationLanguageCode 'language' for message documentation incl. usage of parameters";
		} else {
			$docu = '';
		}

		$authors = $this->doAuthors( $collection );

		$output = <<<PHP
/** $name ($native)
 * $docu
 * To improve a translation please visit http://$wgSitename
 *
 * @ingroup Language
 * @file
 *
$authors */


PHP;
		return $output;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:29,代码来源:PhpVariables.php


示例9: getMessage

 /**
  * Returns of stored translation of message specified by the $key in language
  * code $code.
  *
  * @param string $key Key of the message.
  * @param string $code Language code.
  * @return string|null The translation or null if it doesn't exists.
  */
 public function getMessage($key, $code)
 {
     if ($code && $this->getSourceLanguage() !== $code) {
         return TranslateUtils::getMessageContent($key, $code);
     } else {
         return TranslateUtils::getMessageContent($key, false);
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:16,代码来源:WikiMessageGroup.php


示例10: execute

 public function execute($par)
 {
     $request = $this->getRequest();
     $par = (string) $par;
     // Yes, the use of getVal() and getText() is wanted, see bug T22365
     $this->text = $request->getVal('wpTitle', $par);
     $this->title = Title::newFromText($this->text);
     $this->reason = $request->getText('reason');
     // Checkboxes that default being checked are tricky
     $this->doSubpages = $request->getBool('subpages', !$request->wasPosted());
     $user = $this->getUser();
     if ($this->doBasicChecks() !== true) {
         return;
     }
     $out = $this->getOutput();
     // Real stuff starts here
     if (TranslatablePage::isSourcePage($this->title)) {
         $title = $this->msg('pt-deletepage-full-title', $this->title->getPrefixedText());
         $out->setPagetitle($title);
         $this->code = '';
         $this->page = TranslatablePage::newFromTitle($this->title);
     } else {
         $page = TranslatablePage::isTranslationPage($this->title);
         if ($page) {
             $title = $this->msg('pt-deletepage-lang-title', $this->title->getPrefixedText());
             $out->setPagetitle($title);
             list(, $this->code) = TranslateUtils::figureMessage($this->title->getText());
             $this->page = $page;
         } else {
             throw new ErrorPageError('pt-deletepage-invalid-title', 'pt-deletepage-invalid-text');
         }
     }
     if (!$user->isAllowed('pagetranslation')) {
         throw new PermissionsError('pagetranslation');
     }
     // Is there really no better way to do this?
     $subactionText = $request->getText('subaction');
     switch ($subactionText) {
         case $this->msg('pt-deletepage-action-check')->text():
             $subaction = 'check';
             break;
         case $this->msg('pt-deletepage-action-perform')->text():
             $subaction = 'perform';
             break;
         case $this->msg('pt-deletepage-action-other')->text():
             $subaction = '';
             break;
         default:
             $subaction = '';
     }
     if ($subaction === 'check' && $this->checkToken() && $request->wasPosted()) {
         $this->showConfirmation();
     } elseif ($subaction === 'perform' && $this->checkToken() && $request->wasPosted()) {
         $this->performAction();
     } else {
         $this->showForm();
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:58,代码来源:SpecialPageTranslationDeletePage.php


示例11: getData

 public function getData()
 {
     $translation = null;
     $title = $this->handle->getTitle();
     $translation = TranslateUtils::getMessageContent($this->handle->getKey(), $this->handle->getCode(), $title->getNamespace());
     Hooks::run('TranslatePrefillTranslation', array(&$translation, $this->handle));
     $fuzzy = MessageHandle::hasFuzzyString($translation) || $this->handle->isFuzzy();
     $translation = str_replace(TRANSLATE_FUZZY, '', $translation);
     return array('language' => $this->handle->getCode(), 'fuzzy' => $fuzzy, 'value' => $translation);
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:10,代码来源:CurrentTranslationAid.php


示例12: doHeader

 protected function doHeader(MessageCollection $collection)
 {
     global $wgSitename;
     $code = $collection->code;
     $name = TranslateUtils::getLanguageName($code);
     $native = TranslateUtils::getLanguageName($code, $code);
     $output = "# Messages for {$name} ({$native})\n";
     $output .= "# Exported from {$wgSitename}\n\n";
     return $output;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:10,代码来源:DtdFFS.php


示例13: getData

 public function getData()
 {
     global $wgTranslateDocumentationLanguageCode, $wgContLang;
     if (!$wgTranslateDocumentationLanguageCode) {
         throw new TranslationHelperException('Message documentation is disabled');
     }
     $page = $this->handle->getKey();
     $ns = $this->handle->getTitle()->getNamespace();
     $info = TranslateUtils::getMessageContent($page, $wgTranslateDocumentationLanguageCode, $ns);
     return array('language' => $wgContLang->getCode(), 'value' => $info, 'html' => $this->context->getOutput()->parse($info));
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:11,代码来源:DocumentationAid.php


示例14: doHeader

 /**
  * @param $collection MessageCollection
  * @return string
  */
 protected function doHeader(MessageCollection $collection)
 {
     global $wgSitename;
     global $wgTranslateYamlLibrary;
     $code = $collection->code;
     $name = TranslateUtils::getLanguageName($code);
     $native = TranslateUtils::getLanguageName($code, $code);
     $output = "# Messages for {$name} ({$native})\n";
     $output .= "# Exported from {$wgSitename}\n";
     if (isset($wgTranslateYamlLibrary)) {
         $output .= "# Export driver: {$wgTranslateYamlLibrary}\n";
     }
     return $output;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:18,代码来源:YamlFFS.php


示例15: execute

 public function execute()
 {
     $hours = (int) $this->getOption('days');
     $hours = $hours ? $hours * 7 : 7 * 24;
     $top = (int) $this->getOption('top');
     $top = $top ? $top : 10;
     $bots = $this->hasOption('bots');
     $namespaces = array();
     if ($this->hasOption('ns')) {
         $input = explode(',', $this->getOption('ns'));
         foreach ($input as $namespace) {
             if (is_numeric($namespace)) {
                 array_push($namespaces, $namespace);
             }
         }
     }
     /**
      * Select set of edits to report on
      */
     $rows = TranslateUtils::translationChanges($hours, $bots, $namespaces);
     /**
      * Get counts for edits per language code after filtering out edits by FuzzyBot
      */
     $codes = array();
     global $wgTranslateFuzzyBotName;
     foreach ($rows as $_) {
         // Filter out edits by $wgTranslateFuzzyBotName
         if ($_->rc_user_text === $wgTranslateFuzzyBotName) {
             continue;
         }
         list(, $code) = TranslateUtils::figureMessage($_->rc_title);
         if (!isset($codes[$code])) {
             $codes[$code] = 0;
         }
         $codes[$code]++;
     }
     /**
      * Sort counts and report descending up to $top rows.
      */
     arsort($codes);
     $i = 0;
     foreach ($codes as $code => $num) {
         if ($i++ === $top) {
             break;
         }
         $this->output("{$code}\t{$num}\n");
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:48,代码来源:languageeditstats.php


示例16: getTranslations

 /**
  * Returns all translations of a given message.
  * @param MessageHandle $handle Language code is ignored.
  * @return array[]
  * @since 2012-12-18
  */
 public static function getTranslations(MessageHandle $handle)
 {
     $namespace = $handle->getTitle()->getNamespace();
     $base = $handle->getKey();
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page', array('page_namespace', 'page_title'), array('page_namespace' => $namespace, 'page_title ' . $dbr->buildLike("{$base}/", $dbr->anyString())), __METHOD__, array('ORDER BY' => 'page_title', 'USE INDEX' => 'name_title'));
     $titles = array();
     foreach ($res as $row) {
         $titles[] = $row->page_title;
     }
     if ($titles === array()) {
         return array();
     }
     $pageInfo = TranslateUtils::getContents($titles, $namespace);
     return $pageInfo;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:22,代码来源:ApiQueryMessageTranslations.php


示例17: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     $title = Title::newFromText($params['title']);
     if (!$title) {
         $this->dieUsage('Invalid title');
     }
     $handle = new MessageHandle($title);
     if (!$handle->isValid()) {
         $this->dieUsage('Title does not correspond to a translatable message');
     }
     $base = Title::makeTitle($title->getNamespace(), $handle->getKey());
     $namespace = $base->getNamespace();
     $message = $base->getDBKey();
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page', array('page_namespace', 'page_title'), array('page_namespace' => $namespace, 'page_title ' . $dbr->buildLike("{$message}/", $dbr->anyString())), __METHOD__, array('ORDER BY' => 'page_title', 'USE INDEX' => 'name_title'));
     $titles = array();
     foreach ($res as $row) {
         $titles[] = $row->page_title;
     }
     $pageInfo = TranslateUtils::getContents($titles, $namespace);
     $result = $this->getResult();
     $pages = array();
     $count = 0;
     foreach ($pageInfo as $key => $info) {
         if (++$count <= $params['offset']) {
             continue;
         }
         $tTitle = Title::makeTitle($namespace, $key);
         $tHandle = new MessageHandle($tTitle);
         $data = array('title' => $tTitle->getPrefixedText(), 'language' => $tHandle->getCode(), 'lasttranslator' => $info[1]);
         $fuzzy = MessageHandle::hasFuzzyString($info[0]) || $tHandle->isFuzzy();
         if ($fuzzy) {
             $data['fuzzy'] = 'fuzzy';
         }
         $translation = str_replace(TRANSLATE_FUZZY, '', $info[0]);
         $result->setContent($data, $translation);
         $fit = $result->addValue(array('query', $this->getModuleName()), null, $data);
         if (!$fit) {
             $this->setContinueEnumParameter('offset', $count);
             break;
         }
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'message');
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:45,代码来源:ApiQueryMessageTranslations.php


示例18: run

	function run() {
		// Initialization
		$title = $this->title;
		list( , $code ) = TranslateUtils::figureMessage( $title->getPrefixedText() );

		// Return the actual translation page...
		$page = TranslatablePage::isTranslationPage( $title );
		if ( !$page ) {
			var_dump( $this->params );
			var_dump( $title );
			throw new MWException( "Oops, this should not happen!" );
		}

		$group = $page->getMessageGroup();
		$collection = $group->initCollection( $code );
		$collection->loadTranslations( DB_MASTER );

		$text = $page->getParse()->getTranslationPageText( $collection );

		// Other stuff
		$user    = $this->getUser();
		$summary = $this->getSummary();
		$flags   = $this->getFlags();

		$article = new Article( $title, 0 );

		// @todo FuzzyBot hack
		PageTranslationHooks::$allowTargetEdit = true;

		// Do the edit
		$status = $article->doEdit( $text, $summary, $flags, false, $user );
		SpecialPageTranslation::superDebug( __METHOD__, 'edit', $user, $title, $flags, $status );

		PageTranslationHooks::$allowTargetEdit = false;

		// purge cache
		$page->getTranslationPercentages( true );

		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:40,代码来源:RenderJob.php


示例19: run

 function run()
 {
     global $wgTranslateDocumentationLanguageCode;
     $title = $this->title;
     $params = $this->params;
     $user = FuzzyBot::getUser();
     $flags = EDIT_DEFER_UPDATES | EDIT_FORCE_BOT;
     $wikiPage = WikiPage::factory($title);
     $summary = wfMessage('translate-manage-import-summary')->inContentLanguage()->plain();
     $content = ContentHandler::makeContent($params['content'], $title);
     $wikiPage->doEditContent($content, $summary, $flags, false, $user);
     // NOTE: message documentation is excluded from fuzzying!
     if ($params['fuzzy']) {
         $handle = new MessageHandle($title);
         $key = $handle->getKey();
         $languages = TranslateUtils::getLanguageNames('en');
         unset($languages[$wgTranslateDocumentationLanguageCode]);
         $languages = array_keys($languages);
         $dbw = wfGetDB(DB_MASTER);
         $fields = array('page_id', 'page_latest');
         $conds = array('page_namespace' => $title->getNamespace());
         $pages = array();
         foreach ($languages as $code) {
             $otherTitle = Title::makeTitleSafe($title->getNamespace(), "{$key}/{$code}");
             $pages[$otherTitle->getDBKey()] = true;
         }
         unset($pages[$title->getDBKey()]);
         if (count($pages) === 0) {
             return true;
         }
         $conds['page_title'] = array_keys($pages);
         $res = $dbw->select('page', $fields, $conds, __METHOD__);
         $inserts = array();
         foreach ($res as $row) {
             $inserts[] = array('rt_type' => RevTag::getType('fuzzy'), 'rt_page' => $row->page_id, 'rt_revision' => $row->page_latest);
         }
         $dbw->replace('revtag', array(array('rt_type', 'rt_page', 'rt_revision')), $inserts, __METHOD__);
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:40,代码来源:MessageUpdateJob.php


示例20: getMessageParameters

 public function getMessageParameters()
 {
     $params = parent::getMessageParameters();
     $legacy = $this->entry->getParameters();
     $type = $this->entry->getFullType();
     switch ($type) {
         case 'pagetranslation/mark':
             $revision = $legacy['revision'];
             $targetPage = $this->makePageLink($this->entry->getTarget(), array('oldid' => $revision));
             $params[2] = Message::rawParam($targetPage);
             break;
         case 'pagetranslation/moveok':
         case 'pagetranslation/movenok':
         case 'pagetranslation/deletefnok':
         case 'pagetranslation/deletelnok':
             $target = $legacy['target'];
             $moveTarget = $this->makePageLink(Title::newFromText($target));
             $params[3] = Message::rawParam($moveTarget);
             break;
         case 'pagetranslation/prioritylanguages':
             $params[3] = $legacy['force'];
             $languages = $legacy['languages'];
             if ($languages !== false) {
                 $lang = $this->context->getLanguage();
                 $languages = array_map('trim', preg_split('/,/', $languages, -1, PREG_SPLIT_NO_EMPTY));
                 $languages = array_map(function ($code) use($lang) {
                     return TranslateUtils::getLanguageName($code, $lang->getCode());
                 }, $languages);
                 $params[4] = $lang->listToText($languages);
             }
             break;
         case 'pagetranslation/associate':
         case 'pagetranslation/dissociate':
             $params[3] = $legacy['aggregategroup'];
             break;
     }
     return $params;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:38,代码来源:PageTranslationLogFormatter.php



注:本文中的TranslateUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Translation类代码示例发布时间:2022-05-23
下一篇:
PHP Translate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap