当前位置: 首页>>代码示例>>PHP>>正文


PHP Language::getTranslatedLanguageNames方法代码示例

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


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

示例1: addConfig

 public static function addConfig(&$vars)
 {
     global $wgLang;
     $names = Language::getTranslatedLanguageNames($wgLang->getCode());
     $vars['wgKieliLanguages'] = $names;
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:Kieli.php

示例2: view

	public function view() {
		global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
		
		$diff = $wgRequest->getVal( 'diff' );
		$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );

		if ( $this->mTitle->getNamespace() != NS_TIMEDTEXT || ( isset( $diff ) && $diffOnly ) ) {
			return parent::view();
		}
		$titleParts = explode( '.', $this->mTitle->getDBKey() );
		$srt = array_pop( $titleParts );
		$lanugaeKey = array_pop( $titleParts );
		$videoTitle = Title::newFromText( implode('.', $titleParts ), NS_FILE );
		
		// Look up the language name: 	
		$languages = Language::getTranslatedLanguageNames( 'en' );
		if( isset( $languages[ $lanugaeKey ] ) ) {
			$languageName = $languages[ $lanugaeKey ];
		} else {
			$languageName = $lanugaeKey;
		}
		
		// Set title 
		$wgOut->setPageTitle( wfMsg('mwe-timedtext-language-subtitles-for-clip', $languageName,  $videoTitle) );

		// Get the video with with a max of 600 pixel page
		$wgOut->addHTML( 
			xml::tags( 'table', array( 'style'=> 'border:none' ), 
				xml::tags( 'tr', null, 
					xml::tags( 'td', array( 'valign' => 'top',  'width' => self::$videoWidth ), $this->getVideoHTML( $videoTitle ) ) .
					xml::tags( 'td', array( 'valign' => 'top' ) , $this->getSrtHTML( $languageName ) )
				)
			)
		);	
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:35,代码来源:TimedTextPage.php

示例3: getName

 /**
  * Take a code as input, and attempt to find a language name for it in
  * a a given language, uses the order:
  *     - CLDR extension
  *     - MediaWiki language names
  *     - Babel language names CDB
  *
  * @param $code String: Code to get name for.
  * @param $language String: Code of language to attempt to get name in,
  *                  defaults to language of code.
  * @return String (name of language) or false (invalid language code).
  */
 public static function getName($code, $language = null)
 {
     global $wgBabelLanguageNamesCdb;
     // Get correct code, even though it should already be correct.
     $code = self::getCode($code);
     if ($code === false) {
         return false;
     }
     $language = $language === null ? $code : $language;
     $names = Language::getTranslatedLanguageNames($language);
     if (isset($names[$code])) {
         return $names[$code];
     }
     $names = CdbReader::open($wgBabelLanguageNamesCdb);
     return $names->get($code);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:BabelLanguageCodes.class.php

示例4: appendLanguages

 public function appendLanguages($property)
 {
     $params = $this->extractRequestParams();
     $langCode = isset($params['inlanguagecode']) ? $params['inlanguagecode'] : '';
     if ($langCode) {
         $langNames = Language::getTranslatedLanguageNames($langCode);
     } else {
         $langNames = Language::getLanguageNames();
     }
     $data = array();
     foreach ($langNames as $code => $name) {
         $lang = array('code' => $code);
         ApiResult::setContent($lang, $name);
         $data[] = $lang;
     }
     $this->getResult()->setIndexedTagName($data, 'lang');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:18,代码来源:ApiQuerySiteinfo.php

示例5: language

 /**
  * Gives language names.
  * @param $parser Parser
  * @param $code String  Language code
  * @param $language String  Language code
  * @return String
  */
 static function language($parser, $code = '', $language = '')
 {
     global $wgContLang;
     $code = strtolower($code);
     $language = strtolower($language);
     if ($language !== '') {
         $names = Language::getTranslatedLanguageNames($language);
         return isset($names[$code]) ? $names[$code] : wfBCP47($code);
     }
     $lang = $wgContLang->getLanguageName($code);
     return $lang !== '' ? $lang : wfBCP47($code);
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:19,代码来源:CoreParserFunctions.php

示例6: getLanguageNames

	/**
	 * Get translated language names.
	 * @return array
	 */
	public static function getLanguageNames( /*string */ $code ) {
		if ( is_callable( array( 'Language', 'getTranslatedLanguageNames' ) ) ) {
			return Language::getTranslatedLanguageNames( $code );
		} elseif ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
			return LanguageNames::getNames( $code,
				LanguageNames::FALLBACK_NORMAL,
				LanguageNames::LIST_MW
			);
		} else {
			return Language::getLanguageNames( false );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:TranslateUtils.php

示例7: formatTranslationreviewLogEntry

	public static function formatTranslationreviewLogEntry( $type, $action, $title, $forUI, $params ) {
		global $wgLang, $wgContLang;

		$language = $forUI === null ? $wgContLang : $wgLang;
		$linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;

		if ( $action === 'message' ) {
			$link = $forUI ?
				$linker->link( $title, null, array(), array( 'oldid' => $params[0] ) ) :
				$title->getPrefixedText();
			return wfMessage( 'logentry-translationreview-message' )->params(
				'', // User link in the new system
				'#', // User name for gender in the new system
				Message::rawParam( $link )
			)->inLanguage( $language )->text();
		}

		if ( $action === 'group' ) {
			$languageCode = $params[0];
			$languageNames = Language::getTranslatedLanguageNames( $languageCode );
			$languageName = "$languageNames[$languageCode] ($languageCode)";
			$groupLabel = $params[1];
			$oldState = $params[2];
			$newState = $params[3];
			$oldStateMessage = wfMessage( "translate-workflow-state-$oldState" );
			$newStateMessage = wfMessage( "translate-workflow-state-$newState" );
			$oldState = $oldStateMessage->isBlank() ? $oldState : $oldStateMessage->text();
			$newState = $newStateMessage->isBlank() ? $newState : $newStateMessage->text();

			$link = $forUI ?
				$linker->link( $title, $groupLabel, array(), array( 'language' => $languageCode ) ) :
				$groupLabel;

			return wfMessage( 'logentry-groupreview-message' )->params(
				'', // User link in the new system
				'#', // User name for gender in the new system
				Message::rawParam( $link ),
				$languageName,
				$oldState,
				$newState
			)->inLanguage( $language )->text();
		}

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

示例8: getLanguageNames

	/**
	 * This loads language names. Also from CLDR if that extension is found.
	 * @return Array with language names
	 */
	static public function getLanguageNames( $code = null ) {
		global $wgLang;
		$langcode = ( $code ? $code : $wgLang->getCode() );
		return Language::getTranslatedLanguageNames( $langcode );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:9,代码来源:IncubatorTest.php


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