Help:Magic words/ja

Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. This page is about usage of standard magic words; for a technical reference, see.

マジックワードには以下の 3 種類があります:


 * 挙動の切り替え: 大文字の語句を二重の下線で囲んだ形式です. 例: __FOO__


 * Variables: these are uppercase words surrounded by double braces, e.g.  . As such, they look a lot like templates.


 * Parser functions: these take parameters and are either of the form   or  . See also.

Variables and parser functions can use subst:, just like templates. Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message.

挙動の切り替え
A behavior switch controls the layout or behavior of the page and can often be used to specify desired omissions and inclusions in the content.

変数
変数は、現在のページ、現在のウィキ、現在日時についての情報を返します. 変数の構文はテンプレートと類似しています. 「 [高負荷] 」の印がある変数は、(その使用が) ソフトウェアによって追跡されるものであり、ページ内で使用できる回数に上限があります.

If a template name conflicts with a variable, the variable will be used (so to transclude the template    :PAGENAME you would need to write  ). In some cases, adding parameters will force the parser to invoke a template; for example,  transcludes     :CURRENTDAYNAME, not the variable.

日付と時刻
以下の変数は現在の日付と時刻を UTC で返します.

MediaWiki およびブラウザーのキャッシュが働くため、これらの変数は、現在の日時ではなくページが キャッシュされた 日時を返します.

The date and time magic words are formatted in the wiki content language. Since, they depend on the page content language.

以下の変数は上記と同じことを行ないますが、サイトのサーバー設定や $wgLocaltimezone の値を使用します.

For more thorough time formatting, you may want to install Extension:ParserFunctions to use the #time parser function.

技術的なメタデータ
Note: Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.

統計
Numbers returned by these variables normally contain separators (commas, dots or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example,  &rarr;  and   &rarr; ).

Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example  and , or   and  ). Also applicable to  hereinbefore.

The number magic words are formatted in the wiki content language. Since, it depends on the page content language.

ページ名
The  and   magic words only work in namespaces that have subpages enabled. See for information on enabling subpages.

As of, these can all take a parameter, allowing specification of the page to be operated on, instead of just the current page:
 * &rarr; 

例えば、ページ名が「L'Aquila」の場合、以下のコードの実行結果は文字列「数値実体参照」になります:

URL エンコードされたページ名
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters HTML escaped using numeric character encoding):



Note that,   and   have distinct implementations. See Manual:PAGENAMEE encoding for details.

名前空間
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):



では、完全なページ名のパラメーターを指定でき、(現在のページではなく) 指定したページの名前空間名を返します:

パラメーターには名前空間名は指定できません:
 * &rarr; 
 * &rarr; 
 * &rarr; 
 * &rarr;   (Empty)

パーサー関数
Parser functions are very similar to variables, but take one or more parameters (technically, any magic word that takes a parameter is a parser function), and the name is sometimes prefixed with a hash to distinguish them from templates.

This page only describes parser functions that are integral to the MediaWiki software. Other parser functions may be added by MediaWiki extensions such as the. For those see Help:Extension:ParserFunctions.

名前空間
returns the current localized name for the namespace with that index, canonical name, or local alias. Thus,  , and   (an old name for the File namespace) all return "    ". On a wiki where the content language is French,  is also valid, but   (the localisation of "File" in German) is not.

is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.

Don't confuse localised namespaces with custom namespaces.

整形
関連項目: Extension:StringFunctions

地域化
Here are the magic words which are used as main localisation tools. Other magic words will often depend on the wiki's locale and configuration or on the chosen language: see in particular, ,. More magic words are added by the Translate extension.

The usage of these magic words can be very complex, and the documentation is currently incomplete; there's some more info on PLURAL, GRAMMAR, GENDER.