本文整理汇总了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;
}
示例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 ) )
)
)
);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
}
示例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 '';
}
示例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 );
}