API:语言信息

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Languageinfo and the translation is 100% complete.
Other languages:
English • ‎français • ‎中文 • ‎日本語
MediaWiki版本: 1.34

用于获取此MediaWiki安装支持的语言信息的API。

API文档


meta=languageinfo (li)

(main | query | languageinfo)

Return information about available languages.

Continuation may be applied if retrieving the information takes too long for one request.

Parameters:
liprop

Which information to get for each language.

code
The language code. (This code is MediaWiki-specific, though there are overlaps with other standards.)
bcp47
The BCP-47 language code.
dir
The writing direction of the language (either ltr or rtl).
autonym
The autonym of the language, that is, the name in that language.
name
The name of the language in the language specified by the uselang parameter, with language fallbacks applied if necessary.
fallbacks
The language codes of the fallback languages configured for this language. The implicit final fallback to 'en' is not included (but some languages may fall back to 'en' explicitly).
variants
The language codes of the variants supported by this language.
Values (separate with | or alternative): code, bcp47, dir, autonym, name, fallbacks, variants
Default: code
licode

Language codes of the languages that should be returned, or * for all languages.

Separate values with | or alternative. Maximum number of values is 50 (500 for bots).
Default: *
licontinue

When more results are available, use this to continue.

Examples:
Get the language codes of all supported languages.
api.php?action=query&meta=languageinfo [open in sandbox]
Get the autonyms and German names of all supported languages.
api.php?action=query&meta=languageinfo&liprop=autonym|name&uselang=de [open in sandbox]
Get the fallback languages and variants of Occitan.
api.php?action=query&meta=languageinfo&liprop=fallbacks|variants&licode=oc [open in sandbox]
Get the BCP-47 language code and direction of all supported languages.
api.php?action=query&meta=languageinfo&liprop=bcp47|dir [open in sandbox]