Manual:$wgContLang
Appearance
この機能は、バージョン 1.36.0 で完全に除去されました。 |
| グローバル オブジェクト: $wgContLang | |
|---|---|
| 本文の言語 | |
| 廃止予定になった時点のバージョン: | 1.32.0 |
| 除去された時点のバージョン: | 1.36.0 |
| クラス: | Language |
| 場所: | Language.php |
詳細
本文の言語のオブジェクトは、閲覧しているウィキに関連付けられた Language オブジェクトです。
2 つあるグローバルの言語オブジェクトのうちの 1 つです (もう一方は $wgLang)。
Language objects represent the language used for incidental text, and also has some character encoding functions and other locale stuff.
言語は $wgLanguageCode で定義されています。
詳細情報は Manual:言語 を参照してください。
If you are outputting text that might be included in an interface message, you may want to use
$parser->getFunctionLang() instead of $wgContLang since this will localize to the user's interface language within interface messages, but localize to the wiki content language otherwise.| MediaWiki バージョン: | ≧ 1.32 |
Starting with MediaWiki 1.32, the content language is available as the ContentLanguage service (MediaWiki\MediaWikiServices::getContentLanguage) and usage of the service is recommended over using the global.
よく使用されるメソッド
This is not an exhaustive list, view class above to see a complete listing.
$wgContLang->getNsText ( $index )- キーをもとにして、名前空間名を現在の言語で取得します。 例:
$wgContLang->getNsText( NS_MEDIAWIKI );は「MediaWiki」を返し、$wgContLang->getNsText( NS_CATEGORY )は「カテゴリ」を返します。
$wgContLang->specialPage( $name )- 英語の語句をもとにして、地域化された特別ページ名を取得します。 例:
$wgContLang->specialPage( 'upload' )は「特別:upload」を返します。
$wgContLang->convert( $text, $isTitle = false)- 実装されていません。テキストを別の言語変種に変換します。
$wgContLang->formatSize ( $size )- Format a size in bytes for output, using an appropriate unit (B, KB, MB or GB) according to the magnitude in question
$wgContLang->formatTimePeriod( $seconds )- Format a time in seconds for output, using an appropriate unit (seconds, minutes, hours or days) according to the magnitude in question