CINXE.COM

Manual:Messages API - MediaWiki

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Manual:Messages API - MediaWiki</title> <script>(function(){var className="client-js vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )mediawikiwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"f8d2f1ce-0186-435d-83c3-3f07acc225eb","wgCanonicalNamespace":"Manual","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":100,"wgPageName":"Manual:Messages_API","wgTitle":"Messages API","wgCurRevisionId":6865557,"wgRevisionId":6865557,"wgArticleId":45493,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["MediaWiki code","Localisation"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Manual:Messages_API","wgRelevantArticleId":45493,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":["autoconfirmed"],"wgRestrictionMove":["autoconfirmed"],"wgNoticeProject":"mediawiki","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true, "wgMediaViewerEnabledByDefault":true,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":50000,"wgTranslatePageTranslation":"source","wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"]};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.translate.tag.languages":"ready","ext.pygments":"ready","ext.cite.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles": "ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.translate.edit.documentation.styles":"ready","ext.translate":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.pygments.view","ext.cite.ux-enhancements","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.translate.pagetranslation.uls","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface","ext.checkUser.clientHints"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.5"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Manual:Messages API - MediaWiki"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//m.mediawiki.org/wiki/Manual:Messages_API"> <link rel="apple-touch-icon" href="/static/apple-touch/mediawiki.png"> <link rel="icon" href="/static/favicon/mediawiki.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="MediaWiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="//www.mediawiki.org/w/api.php?action=rsd"> <link rel="canonical" href="https://www.mediawiki.org/wiki/Manual:Messages_API"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"> <link rel="alternate" type="application/atom+xml" title="MediaWiki Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-100 ns-subject page-Manual_Messages_API rootpage-Manual_Messages_API skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/MediaWiki" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-mw-download" class="mw-list-item"><a href="/wiki/Download"><span>Get MediaWiki</span></a></li><li id="n-mw-extensions" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Category:Extensions"><span>Get extensions</span></a></li><li id="n-blog-text" class="mw-list-item"><a href="https://techblog.wikimedia.org/"><span>Tech blog</span></a></li><li id="n-mw-contribute" class="mw-list-item"><a href="/wiki/Special:MyLanguage/How_to_contribute"><span>Contribute</span></a></li> </ul> </div> </div> <div id="p-support" class="vector-menu mw-portlet mw-portlet-support" > <div class="vector-menu-heading"> Support </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Help:Contents" title="The place to find out"><span>User help</span></a></li><li id="n-mw-faq" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:FAQ"><span>FAQ</span></a></li><li id="n-mw-manual" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:Contents"><span>Technical manual</span></a></li><li id="n-mw-supportdesk" class="mw-list-item"><a href="/wiki/Project:Support_desk"><span>Support desk</span></a></li><li id="n-mw-communication" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Communication"><span>Communication</span></a></li> </ul> </div> </div> <div id="p-development" class="vector-menu mw-portlet mw-portlet-development" > <div class="vector-menu-heading"> Development </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mw-developerportal" class="mw-list-item"><a href="https://developer.wikimedia.org/"><span>Developer portal</span></a></li><li id="n-svn-statistics" class="mw-list-item"><a href="/wiki/Development_statistics"><span>Code statistics</span></a></li> </ul> </div> </div> <div id="p-mediawiki.org" class="vector-menu mw-portlet mw-portlet-mediawiki_org" > <div class="vector-menu-heading"> mediawiki.org </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-portal" class="mw-list-item"><a href="/wiki/Project:Help" title="About the project, what you can do, where to find things"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-mw-translate" class="mw-list-item"><a href="/wiki/Special:LanguageStats"><span>Translate content</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li><li id="n-mw-discussion" class="mw-list-item"><a href="/wiki/Project:Village_Pump"><span>Village pump</span></a></li><li id="n-Sandboxlink-portlet-label" class="mw-list-item"><a href="/wiki/Project:Sandbox"><span>Sandbox</span></a></li> </ul> </div> </div> <div id="p-lang" class="vector-menu mw-portlet mw-portlet-lang" > <div class="vector-menu-heading"> In other languages </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-add wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&amp;page=Manual%3AMessages+API" title="Add interlanguage links" class="wbc-editpage">Add links</a></span></div> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/MediaWiki" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/mediawikiwiki.svg" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="MediaWiki" src="/static/images/mobile/copyright/mediawikiwiki-wordmark.svg" style="width: 7.5em; height: 1.125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search MediaWiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search MediaWiki" aria-label="Search MediaWiki" autocapitalize="sentences" title="Search MediaWiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-uls" class="mw-list-item active user-links-collapsible-item"><a data-mw="interface" href="#" class="uls-trigger cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>English</span></a> </li> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=www.mediawiki.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Manual%3AMessages+API" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Manual%3AMessages+API" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="More options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=www.mediawiki.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Manual%3AMessages+API" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Manual%3AMessages+API" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Beginning</div> </a> </li> <li id="toc-Message_parameters" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Message_parameters"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Message parameters</span> </div> </a> <button aria-controls="toc-Message_parameters-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Message parameters subsection</span> </button> <ul id="toc-Message_parameters-sublist" class="vector-toc-list"> <li id="toc-Referring_to_other_messages" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Referring_to_other_messages"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Referring to other messages</span> </div> </a> <ul id="toc-Referring_to_other_messages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Switches_in_messages…" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Switches_in_messages…"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Switches in messages…</span> </div> </a> <ul id="toc-Switches_in_messages…-sublist" class="vector-toc-list"> <li id="toc-…on_numbers_via_PLURAL" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#…on_numbers_via_PLURAL"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.1</span> <span>…on numbers via PLURAL</span> </div> </a> <ul id="toc-…on_numbers_via_PLURAL-sublist" class="vector-toc-list"> <li id="toc-Be_aware_of_PLURAL_use_on_all_numbers" class="vector-toc-list-item vector-toc-level-4"> <a class="vector-toc-link" href="#Be_aware_of_PLURAL_use_on_all_numbers"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.1.1</span> <span>Be aware of PLURAL use on <i>all</i> numbers</span> </div> </a> <ul id="toc-Be_aware_of_PLURAL_use_on_all_numbers-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pass_the_number_of_list_items_as_parameters_to_messages_talking_about_lists" class="vector-toc-list-item vector-toc-level-4"> <a class="vector-toc-link" href="#Pass_the_number_of_list_items_as_parameters_to_messages_talking_about_lists"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.1.2</span> <span>Pass the number of list items as parameters to messages talking about lists</span> </div> </a> <ul id="toc-Pass_the_number_of_list_items_as_parameters_to_messages_talking_about_lists-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-…on_user_names_via_GENDER" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#…on_user_names_via_GENDER"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.2</span> <span>…on user names via GENDER</span> </div> </a> <ul id="toc-…on_user_names_via_GENDER-sublist" class="vector-toc-list"> <li id="toc-Users_have_grammatical_genders" class="vector-toc-list-item vector-toc-level-4"> <a class="vector-toc-link" href="#Users_have_grammatical_genders"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.2.1</span> <span>Users have grammatical genders</span> </div> </a> <ul id="toc-Users_have_grammatical_genders-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-…on_use_context_inside_sentences_via_GRAMMAR" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#…on_use_context_inside_sentences_via_GRAMMAR"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.3</span> <span>…on use context inside sentences via GRAMMAR</span> </div> </a> <ul id="toc-…on_use_context_inside_sentences_via_GRAMMAR-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Filtering_special_characters_in_parameters_and_messages" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Filtering_special_characters_in_parameters_and_messages"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Filtering special characters in parameters and messages</span> </div> </a> <ul id="toc-Filtering_special_characters_in_parameters_and_messages-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Using_messages_in_PHP" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Using_messages_in_PHP"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Using messages in PHP</span> </div> </a> <button aria-controls="toc-Using_messages_in_PHP-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Using messages in PHP subsection</span> </button> <ul id="toc-Using_messages_in_PHP-sublist" class="vector-toc-list"> <li id="toc-Parameters" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Parameters"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Parameters</span> </div> </a> <ul id="toc-Parameters-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Language" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Language"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2</span> <span>Language</span> </div> </a> <ul id="toc-Language-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Output_modes_and_escaping" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Output_modes_and_escaping"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.3</span> <span>Output modes and escaping</span> </div> </a> <ul id="toc-Output_modes_and_escaping-sublist" class="vector-toc-list"> <li id="toc-Which_output_mode_to_use" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Which_output_mode_to_use"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.3.1</span> <span>Which output mode to use</span> </div> </a> <ul id="toc-Which_output_mode_to_use-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Method_chaining" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Method_chaining"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.4</span> <span>Method chaining</span> </div> </a> <ul id="toc-Method_chaining-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Additional_methods_of_printing_messages" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Additional_methods_of_printing_messages"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.5</span> <span>Additional methods of printing messages</span> </div> </a> <ul id="toc-Additional_methods_of_printing_messages-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Using_messages_in_JavaScript" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Using_messages_in_JavaScript"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Using messages in JavaScript</span> </div> </a> <button aria-controls="toc-Using_messages_in_JavaScript-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Using messages in JavaScript subsection</span> </button> <ul id="toc-Using_messages_in_JavaScript-sublist" class="vector-toc-list"> <li id="toc-Getting_the_messages_to_the_client" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Getting_the_messages_to_the_client"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Getting the messages to the client</span> </div> </a> <ul id="toc-Getting_the_messages_to_the_client-sublist" class="vector-toc-list"> <li id="toc-Using_a_ResourceLoader_module" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Using_a_ResourceLoader_module"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1.1</span> <span>Using a ResourceLoader module</span> </div> </a> <ul id="toc-Using_a_ResourceLoader_module-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Using_an_API_query_from_JavaScript" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Using_an_API_query_from_JavaScript"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1.2</span> <span>Using an API query from JavaScript</span> </div> </a> <ul id="toc-Using_an_API_query_from_JavaScript-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Use_of_the_messages" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Use_of_the_messages"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Use of the messages</span> </div> </a> <ul id="toc-Use_of_the_messages-sublist" class="vector-toc-list"> <li id="toc-Format_options" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Format_options"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2.1</span> <span>Format options</span> </div> </a> <ul id="toc-Format_options-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Parameters_2" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Parameters_2"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2.2</span> <span>Parameters</span> </div> </a> <ul id="toc-Parameters_2-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Feature_support_in_JavaScript" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Feature_support_in_JavaScript"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>Feature support in JavaScript</span> </div> </a> <ul id="toc-Feature_support_in_JavaScript-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-mw.msg" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#mw.msg"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>mw.msg</span> </div> </a> <ul id="toc-mw.msg-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Exporting_messages_through_ResourceLoader_callbacks" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Exporting_messages_through_ResourceLoader_callbacks"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.5</span> <span>Exporting messages through ResourceLoader callbacks</span> </div> </a> <ul id="toc-Exporting_messages_through_ResourceLoader_callbacks-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Using_messages_in_Lua" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Using_messages_in_Lua"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Using messages in Lua</span> </div> </a> <ul id="toc-Using_messages_in_Lua-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes_about_gender,_grammar,_plural" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notes_about_gender,_grammar,_plural"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Notes about gender, grammar, plural</span> </div> </a> <button aria-controls="toc-Notes_about_gender,_grammar,_plural-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Notes about gender, grammar, plural subsection</span> </button> <ul id="toc-Notes_about_gender,_grammar,_plural-sublist" class="vector-toc-list"> <li id="toc-PLURAL_syntax_example" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#PLURAL_syntax_example"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>PLURAL syntax example</span> </div> </a> <ul id="toc-PLURAL_syntax_example-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-GENDER_in_JavaScript" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#GENDER_in_JavaScript"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>GENDER in JavaScript</span> </div> </a> <ul id="toc-GENDER_in_JavaScript-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-PLURAL_in_JavaScript" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#PLURAL_in_JavaScript"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>PLURAL in JavaScript</span> </div> </a> <ul id="toc-PLURAL_in_JavaScript-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Help_with_replacing_deprecated_wfMsg*_functions" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Help_with_replacing_deprecated_wfMsg*_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Help with replacing deprecated wfMsg* functions</span> </div> </a> <ul id="toc-Help_with_replacing_deprecated_wfMsg*_functions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-namespace">Manual</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Messages API</span></h1> <div class="mw-indicators"> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-manual" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Messages_API" title="View the subject page [c]" accesskey="c"><span>Manual</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Manual_talk:Messages_API" rel="discussion" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Messages_API"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;action=edit" title="This page is protected.&#10;You can view its source [e]" accesskey="e"><span>View source</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Manual:Messages_API"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Manual:Messages_API" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Manual:Messages_API" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;oldid=6865557" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Manual%3AMessages_API&amp;id=6865557&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AMessages_API"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AMessages_API"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Book&amp;bookcmd=book_creator&amp;referer=Manual%3AMessages+API"><span>Create a book</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Manual%3AMessages_API&amp;action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Manual:Messages_API&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects emptyPortlet" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div id="siteSub" class="noprint">From mediawiki.org</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-pt-translate-header noprint nomobile" dir="ltr" lang="en"><a href="/w/index.php?title=Special:Translate&amp;group=page-Manual%3AMessages+API&amp;action=page&amp;filter=&amp;action_source=translate_page" title="Special:Translate">Translate this page</a></div><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="mw-pt-languages noprint navigation-not-searchable" lang="en" dir="ltr"><div class="mw-pt-languages-label">Languages:</div><ul class="mw-pt-languages-list"><li><a href="/wiki/Manual:Messages_API/id" class="mw-pt-progress mw-pt-progress--low" title="Manual:API Pesan (4% translated)" lang="id" dir="ltr">Bahasa Indonesia</a></li> <li><a href="/wiki/Manual:Messages_API/de" class="mw-pt-progress mw-pt-progress--low" title="Handbuch:Messages-API (5% translated)" lang="de" dir="ltr">Deutsch</a></li> <li><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en" dir="ltr">English</span></li> <li><a href="/wiki/Manual:Messages_API/nl" class="mw-pt-progress mw-pt-progress--high" title="Handleiding:Messages API (99% translated)" lang="nl" dir="ltr">Nederlands</a></li> <li><a href="/wiki/Manual:Messages_API/es" class="mw-pt-progress mw-pt-progress--complete" title="Manual:API de mensajes (100% translated)" lang="es" dir="ltr">español</a></li> <li><a href="/wiki/Manual:Messages_API/fr" class="mw-pt-progress mw-pt-progress--complete" title="API Messages (100% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Manual:Messages_API/hu" class="mw-pt-progress mw-pt-progress--low" title="Manual:Messages API/hu (1% translated)" lang="hu" dir="ltr">magyar</a></li> <li><a href="/wiki/Manual:Messages_API/pl" class="mw-pt-progress mw-pt-progress--low" title="Manual:Messages API/pl (4% translated)" lang="pl" dir="ltr">polski</a></li> <li><a href="/wiki/Manual:Messages_API/pt" class="mw-pt-progress mw-pt-progress--low" title="Manual:API das Mensagens (1% translated)" lang="pt" dir="ltr">português</a></li> <li><a href="/wiki/Manual:Messages_API/cs" class="mw-pt-progress mw-pt-progress--high" title="Příručka:Zprávy API (99% translated)" lang="cs" dir="ltr">čeština</a></li> <li><a href="/wiki/Manual:Messages_API/ru" class="mw-pt-progress mw-pt-progress--low" title="Manual:API сообщений (4% translated)" lang="ru" dir="ltr">русский</a></li> <li><a href="/wiki/Manual:Messages_API/uk" class="mw-pt-progress mw-pt-progress--low" title="API повідомлень (6% translated)" lang="uk" dir="ltr">українська</a></li> <li><a href="/wiki/Manual:Messages_API/ar" class="mw-pt-progress mw-pt-progress--low" title="Manual:Messages API/ar (0% translated)" lang="ar" dir="rtl">العربية</a></li> <li><a href="/wiki/Manual:Messages_API/zh" class="mw-pt-progress mw-pt-progress--low" title="Manual: (10% translated)" lang="zh" dir="ltr">中文</a></li> <li><a href="/wiki/Manual:Messages_API/ja" class="mw-pt-progress mw-pt-progress--low" title="Manual:メッセージAPI (14% translated)" lang="ja" dir="ltr">日本語</a></li></ul></div> <style data-mw-deduplicate="TemplateStyles:r6651103">.mw-parser-output .nmbox{background:#f8f9fa;border:1px solid #AAA;box-sizing:border-box;margin:2px 0;padding:0}.mw-parser-output .nmbox *{box-sizing:border-box}.mw-parser-output .nmbox-header{background:#eaecf0;padding:4px 0.5em;font-weight:bold;text-align:center;white-space:nowrap}.mw-parser-output .nmbox .mbox-image{display:inline-block;padding-right:1em}.mw-parser-output .nmbox-text{border-top:1px solid #AAA;width:100%;padding:4px 0.5em}@media screen and (min-width:768px){.mw-parser-output .nmbox-header{display:table-cell;border-right:1px solid #AAA;width:1%}.mw-parser-output .nmbox-text{border-top:none;display:table-cell}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .nmbox-header,html.skin-theme-clientpref-night .mw-parser-output .nmbox{background:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .nmbox-header,html.skin-theme-clientpref-os .mw-parser-output .nmbox{background:transparent;color:inherit}}</style> <div class="nmbox noprint mw-content-ltr"><div class="nmbox-header">i18n docs </div> <div class="nmbox-text mbox-text"><style data-mw-deduplicate="TemplateStyles:r6387430">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li,.mw-parser-output .hlist .mw-empty-elt{display:none}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)"\a0 "}</style><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Localisation" title="Special:MyLanguage/Localisation">Localisation</a><span style="display:none"><a href="/wiki/Localisation" title="Localisation"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Help:System_message" title="Special:MyLanguage/Help:System message">System message</a><span style="display:none"><a href="/wiki/Help:System_message" title="Help:System message"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Manual:Messages_API" title="Special:MyLanguage/Manual:Messages API">Messages API</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Language" title="Special:MyLanguage/Manual:Language">Language</a><span style="display:none"><a href="/wiki/Manual:Language" title="Manual:Language"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/translatewiki.net" title="Special:MyLanguage/translatewiki.net">translatewiki.net</a><span style="display:none"><a href="/wiki/Translatewiki.net" title="Translatewiki.net"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Writing_systems" title="Special:MyLanguage/Writing systems">Writing systems</a><span style="display:none"><a href="/wiki/Writing_systems" title="Writing systems"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Directionality_support" title="Special:MyLanguage/Directionality support">Directionality</a><span style="display:none"><a href="/wiki/Directionality_support" title="Directionality support"> </a></span></li></ul> </div></div> </div> <p><a href="/wiki/Special:MyLanguage/Help:System_message" title="Special:MyLanguage/Help:System message">MediaWiki messages</a><span style="display:none"><a href="/wiki/Help:System_message" title="Help:System message"> </a></span> can be used in the code through the Message class and its associated methods. </p> <style data-mw-deduplicate="TemplateStyles:r6870138">.mw-parser-output table.ambox{margin:0 10%;width:unset;border:1px solid var(--border-color-base,#a2a9b1);border-left:10px solid var(--border-color-progressive,#36c);background-color:var(--background-color-neutral-subtle,#f8f9fa);box-sizing:border-box}.mw-parser-output table.ambox+table.ambox,.mw-parser-output table.ambox+link+table.ambox,.mw-parser-output table.ambox+style+table.ambox{margin-top:-1px}.mw-parser-output .ambox td.mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox th.mbox-text,.mw-parser-output .ambox td.mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox td.mbox-image{padding:2px 0 2px 0.5em}.mw-parser-output .ambox td.mbox-imageright{padding:2px 0.5em 2px 0}.mw-parser-output table.ambox-notice{border-left-color:var(--border-color-progressive,#36c)}.mw-parser-output table.ambox-speedy{background-color:var(--background-color-error-subtle,#fee7e6)}.mw-parser-output table.ambox-delete,.mw-parser-output table.ambox-speedy{border-left-color:var(--background-color-error--active,#b32424)}.mw-parser-output table.ambox-content{border-left-color:#f28500}.mw-parser-output table.ambox-style{border-left-color:#fc3}.mw-parser-output table.ambox-move{border-left-color:#9932cc}.mw-parser-output table.ambox-protection{border-left-color:var(--border-color-base,#a2a9b1)}html body.mediawiki .mw-parser-output .ambox.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;box-sizing:border-box;width:238px;font-size:88%;line-height:1.25em}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;box-sizing:border-box;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}</style><table class="ambox ambox-notice plainlinks metadata" role="presentation"><tbody><tr><td class="mbox-image"><div style="width:52px"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/40px-OOjs_UI_icon_information-progressive.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/60px-OOjs_UI_icon_information-progressive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/e/ec/OOjs_UI_icon_information-progressive.svg/80px-OOjs_UI_icon_information-progressive.svg.png 2x" data-file-width="20" data-file-height="20" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">While the examples throughout this document make use of the global function <code>wfMessage()</code>, in most cases it is best not to use this global function. Instead, you should use an object that provides a <a href="/wiki/Special:MyLanguage/Manual:RequestContext.php" title="Special:MyLanguage/Manual:RequestContext.php">RequestContext</a><span style="display:none"><a href="/wiki/Manual:RequestContext.php" title="Manual:RequestContext.php"> </a></span>, and call <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$context</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">()</span></code> on it. In many classes, you can use <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">()</span></code>.</div></td></tr></tbody></table> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Message_parameters">Message parameters</h2></div> <p>Some messages take parameters. They are represented by <code>$1</code>, <code>$2</code>, <code>$3</code>, … in the (static) message texts, and replaced at run time. Typical parameter values are numbers (the "3" in "Delete 3 versions?"), or user names (the "Bob" in "Page last edited by Bob"), page names, links and so on, or sometimes other messages. They can be of arbitrary complexity. </p><p>The list of parameters defined for each specific message is placed in special file "qqq.json" located in "languages/" folder of MediaWiki - read more in <a href="/wiki/Special:MyLanguage/Help:System_message#Message_documentation" title="Special:MyLanguage/Help:System message">Message documentation</a>. </p><p>It's preferable to use whole words with the PLURAL, GENDER, and GRAMMAR magic words. For example, <code>{{PLURAL:$1|subpage|subpages}}</code> is better than <code>sub{{PLURAL:$1|page|pages}}</code>. It makes searching easier. </p> <div class="mw-heading mw-heading3"><h3 id="Referring_to_other_messages">Referring to other messages</h3></div> <p>It's sometimes convenient to refer to sub-messages in a message, e.g. in phrases like "Use the X button" or "Visit the Y page", to ensure that the translations are consistent. To do so, you may use the following syntax: </p> <ul><li><code>{{int:X}}</code> - to use the sub-message in interface language. This is often used when referring to form buttons or site navigation, e.g. <a href="/wiki/MediaWiki:Showpreview" title="MediaWiki:Showpreview">showpreview</a>.</li> <li><code>{{MediaWiki:Y}}</code> - to use the sub-message in content language. This is used when the sub-message defines a translatable name of a local page, e.g. <a href="/wiki/MediaWiki:Mainpage" title="MediaWiki:Mainpage">mainpage</a>, <a href="/wiki/MediaWiki:Grouppage-sysop" title="MediaWiki:Grouppage-sysop">grouppage-sysop</a>, <a href="/wiki/MediaWiki:Policy-url" title="MediaWiki:Policy-url">policy-url</a>.</li> <li><code>{{#Special:Z}}</code> - to use the name of a special page in content language.</li></ul> <p>If you need anything more complicated (e.g. the sub-message used depends on configuration), parse it in your code and pass the whole sub-message as a parameter. </p><p>Example: </p> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span>Before saving, use the <span class="p">{{</span><span class="nf">int</span><span class="p">:</span>foo-test<span class="p">}}</span> button to test the changes. Visit <span class="p">[[{{</span><span class="nn">MediaWiki</span><span class="p">:</span><span class="nt">foo-help</span><span class="p">}}|</span>the help page<span class="p">]]</span> to learn more.Customize this feature at <span class="p">[[{{</span><span class="nf">#Special</span><span class="p">:</span>Preferences<span class="p">}}]]</span>. </pre></div> <div class="mw-heading mw-heading3"><h3 id="Switches_in_messages…"><span id="Switches_in_messages.E2.80.A6"></span>Switches in messages…</h3></div> <p>Parameters values at times influence the exact wording, or grammatical variations in messages. We don't resort to ugly constructs like "$1 (sub)page(s) of his/her userpage", because these are poor for users and we can do better. Instead, we make switches that are parsed according to values that will be known at run time. The static message text then supplies each of the possible choices in a list, preceded by the name of the switch, and a reference to the value that makes a difference. This resembles the way <a href="/wiki/Special:MyLanguage/parser_functions" title="Special:MyLanguage/parser functions">Parser functions</a><span style="display:none"><a href="/wiki/Parser_functions" class="mw-disambig" title="Parser functions"> </a></span> are called in MediaWiki. Several types of switches are available. <b>These only work if you do full parsing, or <code>{{</code>-transformation, for the messages.</b> </p> <div class="mw-heading mw-heading4"><h4 id="…on_numbers_via_PLURAL"><span id=".E2.80.A6on_numbers_via_PLURAL"></span>…on numbers via PLURAL</h4></div> <p>MediaWiki supports plurals, which makes for a nicer-looking product. For example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="s1">&#39;undelete_short&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Undelete {{PLURAL:$1|one edit|$1 edits}}&#39;</span><span class="p">,</span> </pre></div> <p>If there is an explicit plural form to be given for a specific number, it is possible with the following syntax: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="s1">&#39;Box has {{PLURAL:$1|one egg|$1 eggs|12=a dozen eggs}}.&#39;</span> </pre></div> <div class="mw-heading mw-heading5"><h5 id="Be_aware_of_PLURAL_use_on_all_numbers">Be aware of PLURAL use on <i>all</i> numbers</h5></div> <style data-mw-deduplicate="TemplateStyles:r6353907">.mw-parser-output .hatnote{font-style:italic;padding-bottom:0.4em;margin-bottom:0.4em;border-bottom:1px solid #ccc}.mw-parser-output .hatnote.no-border{border-bottom:none}</style><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="https://translatewiki.net/wiki/Plural" class="extiw" title="translatewiki:Plural">translatewiki:Plural</a></div> <p><br /> When a number has to be inserted into a message text, be aware that some languages will have to use PLURAL on it even if always larger than 1. The reason is that PLURAL in languages other than English can make very different and complex distinctions, comparable to English 1<sup>st</sup>, 2<sup>nd</sup>, 3<sup>rd</sup>, 4<sup>th</sup>, … 11<sup>th</sup>, 12<sup>th</sup>, 13<sup>th</sup>, … 21<sup>st</sup>, 22<sup>nd</sup>, 23<sup>rd</sup>, … <i>etc.</i> </p><p>Do not try to supply three different messages for cases like "no items counted", "one item counted", "more items counted". Rather, let one message take them all, and leave it to translators and PLURAL to properly treat any possible differences of presentation for them in their respective languages. </p><p>Always include the number as a parameter if possible. Always add <code>{{PLURAL:}}</code> syntax to the source messages if possible, even if it makes no sense in English. The syntax guides translators. </p><p>Fractional numbers are supported, but the plural rules may not be complete. </p> <div class="mw-heading mw-heading5"><h5 id="Pass_the_number_of_list_items_as_parameters_to_messages_talking_about_lists">Pass the number of list items as parameters to messages talking about lists</h5></div> <p>Don't assume that there's only singular and plural. Many languages have more than two forms, which depend on the actual number used and they have to use <a href="#…on_use_context_inside_sentences_via_GRAMMAR">grammar</a> varying with the number of list items when expressing what is listed in a list visible to readers. Thus, whenever your code computes a list, include <code>count( $list )</code> as parameter to headlines, lead-ins, footers and other messages about the list, even if the count is not used in English. There is a neutral way to talk about invisible lists, so you can have links to lists on extra pages without having to count items in advance. </p> <div class="mw-heading mw-heading4"><h4 id="…on_user_names_via_GENDER"><span id=".E2.80.A6on_user_names_via_GENDER"></span>…on user names via GENDER</h4></div> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="s1">&#39;foobar-edit-review&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Please review {{GENDER:$1|his|her|their}} edits.&#39;</span> </pre></div> <p>If you refer to a user in a message, pass the user name as parameter to the message and add a mention in the message documentation that gender is supported. If it is likely that GENDER will be used in translations for languages with gender inflections, add it explicitly in the English language source message. </p><p>If you directly address the currently logged-in user, leave the user name as parameter empty: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="s1">&#39;foobar-logged-in-user&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;You said {{GENDER:|you were male|you were female|nothing about your gender}}.&#39;</span> </pre></div> <style data-mw-deduplicate="TemplateStyles:r4199130">.mw-parser-output .mw-version{border:1px solid #72777d;font-size:80%;line-height:1.2;border-collapse:collapse}.mw-parser-output .mw-version-ltr{float:right;margin:0 0 .5em .5em;text-align:right}.mw-parser-output .mw-version-rtl{float:left;margin:0 .5em .5em 0;text-align:left}.mw-parser-output .mw-version td{padding:.1em .3em}.mw-parser-output .mw-version-versionbox{border:5px solid #00af89;text-align:center}.mw-parser-output .mw-version-versionnumber{font-weight:bold;font-size:180%}.mw-parser-output .mw-version-version .mw-version-versionbox{border-color:#c8ccd1}.mw-parser-output .mw-version.mw-version-version2 .mw-version-versionbox{border-top-color:#c8ccd1;border-right-color:#c8ccd1;border-left-color:#c8ccd1}.mw-parser-output .mw-version-version-unsupported .mw-version-versionbox{border-color:#d33}.mw-parser-output .mw-version.mw-version-version2-unsupported .mw-version-versionbox{border-top-color:#d33;border-right-color:#d33;border-left-color:#d33}.mw-parser-output .mw-version-version-legacy .mw-version-versionbox{border-color:#f93}.mw-parser-output .mw-version.mw-version-version2-legacy .mw-version-versionbox{border-top-color:#f93;border-right-color:#f93;border-left-color:#f93}.mw-parser-output .mw-version-version-stable .mw-version-versionbox,.mw-parser-output .mw-version.mw-version.mw-version-and-later .mw-version-versionbox{border-color:#00af89}.mw-parser-output .mw-version.mw-version-version2-stable .mw-version-versionbox{border-top-color:#00af89;border-right-color:#00af89;border-left-color:#00af89}.mw-parser-output .mw-version-version-future .mw-version-versionbox{border-color:#8080c0}.mw-parser-output .mw-version.mw-version-version2-future .mw-version-versionbox{border-top-color:#8080c0;border-right-color:#8080c0;border-left-color:#8080c0}.mw-parser-output .mw-version-version-alpha .mw-version-versionbox{border-style:dotted}</style> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>&#8805;</small> 1.31</div><small><a href="https://gerrit.wikimedia.org/r/398772" class="extiw" title="gerrit:398772">Gerrit change 398772</a></small></td> </tr></tbody></table> <p>If you include the user name into the message (e.g. "$1 thanked you."), consider passing it through <code>wfEscapeWikitext()</code> first, to ensure that characters like <code>*</code> or <code>;</code> are not interpreted. </p> <div class="mw-heading mw-heading5"><h5 id="Users_have_grammatical_genders">Users have grammatical genders</h5></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="https://translatewiki.net/wiki/Gender" class="extiw" title="translatewiki:Gender">translatewiki:Gender</a></div> <p><br /> When a message talks about a user, or relates to a user, or addresses a user directly, the user name should be passed to the message as a parameter. Thus languages having to, or wanting to, use proper gender dependent grammar, can do so. This should be done even when the user name is not intended to appear in the message, such as in "inform the user on his/her talk page", which is better made "inform the user on {{GENDER:$1|his|her|their}} talk page" in English as well. </p><p>This does not mean that you are encouraged to "sexualise" messages' language: please use gender-neutral language whenever this can be done with clarity and precision. </p> <div class="mw-heading mw-heading4"><h4 id="…on_use_context_inside_sentences_via_GRAMMAR"><span id=".E2.80.A6on_use_context_inside_sentences_via_GRAMMAR"></span>…on use context inside sentences via GRAMMAR</h4></div> <p>Grammatical transformations for <a href="https://www.wikidata.org/wiki/Special:EntityPage/Q171263" class="extiw" title="d:Special:EntityPage/Q171263">agglutinative language <small>(Q171263)</small></a> is also available. For example for Finnish, where it was an absolute necessity to make language files site-independent, <i>i.e.</i> to remove the Wikipedia references. In Finnish, "about Wikipedia" becomes "Tietoja Wikipediasta" and "you can upload it to Wikipedia" becomes "Voit tallentaa tiedoston Wikipediaan". Suffixes are added depending on how the word is used, plus minor modifications to the base. There is a long list of exceptions, but since only a few words needed to be translated, such as the site name, we didn't need to include it. </p><p>MediaWiki has grammatical transformation functions for over 20 languages. Some of these are just dictionaries for Wikimedia site names, but others have simple algorithms which will fail for all but the most common cases. </p><p>Even before MediaWiki had arbitrary grammatical transformation, it had a nominative/genitive distinction for month names. This distinction is necessary for some languages if you wish to substitute month names into sentences. </p> <div class="mw-heading mw-heading3"><h3 id="Filtering_special_characters_in_parameters_and_messages">Filtering special characters in parameters and messages</h3></div> <p>The other (much simpler) issue with parameter substitution is HTML escaping. Despite being much simpler, MediaWiki does a pretty poor job of it. </p> <div class="mw-heading mw-heading2"><h2 id="Using_messages_in_PHP">Using messages in PHP</h2></div> <table class="warning-message" style="background-color: var( --background-color-error-subtle, #ffe9e5 ); color: var( --color-base, #202122 ); border: 1px var( --border-color-error, #9f3526 ) solid; box-sizing: border-box; margin: 0.5em 0; padding: 0.5em;"><tbody><tr><td style="white-space: nowrap; vertical-align: top;"><span style="position: relative; top: -2px;"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/18px-OOjs_UI_icon_notice-destructive.svg.png" decoding="async" width="18" height="18" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/27px-OOjs_UI_icon_notice-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/36px-OOjs_UI_icon_notice-destructive.svg.png 2x" data-file-width="20" data-file-height="20" /></span></span></span> <b>Warning:</b> </td><td style="padding-left: 0.5em vertical-align: top;">Make sure you always use one of the <a href="#Output_modes_and_escaping">output modes</a> mentioned below</td></tr></tbody></table> <p>Here is a simple example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$out</span> <span class="o">=</span> <span class="nx">Xml</span><span class="o">::</span><span class="na">submitButton</span><span class="p">(</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;submit&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">()</span> <span class="p">);</span> </pre></div> <p><code>wfMessage()</code> is a global function which acts as a wrapper for the Message class, creating a Message object. This example then invokes Message method <code>text()</code> which fetches the text of the 'submit' message in the current language, performs certain language transformations (such as gender and plural), and returns the unescaped message text. </p><p>Here is a more complex example using a message that takes a count and supports linguistic plural handling: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$out</span> <span class="o">=</span> <span class="nx">Xml</span><span class="o">::</span><span class="na">label</span><span class="p">(</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;numberofpages&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="nv">$count</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">()</span> <span class="p">);</span> </pre></div> <p>The following sections explain the code. </p> <div class="mw-heading mw-heading3"><h3 id="Parameters">Parameters</h3></div> <p>Given a message like the following: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;msg&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;Values are $1, $2&quot;</span> <span class="p">}</span> </pre></div> <p>You pass parameters to messages that need them in several ways: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span><span class="p">,</span> <span class="s1">&#39;param1&#39;</span><span class="p">,</span> <span class="s1">&#39;param2&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">params</span><span class="p">(</span> <span class="s1">&#39;param1&#39;</span><span class="p">,</span> <span class="s1">&#39;param2&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span><span class="p">,</span> <span class="p">[</span> <span class="s1">&#39;param1&#39;</span><span class="p">,</span> <span class="s1">&#39;param2&#39;</span> <span class="p">]</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> </pre></div> <p>The first approach is most common, use the second approach when mixing different types of parameters, and you can use the third to construct message objects dynamically from other data. There are <i>different types of parameters</i>: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">params</span><span class="p">(</span> <span class="nv">$username</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">rawParams</span><span class="p">(</span> <span class="nv">$link</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plaintextParams</span><span class="p">(</span> <span class="nv">$userInput</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="nv">$count</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">durationParams</span><span class="p">(</span> <span class="nv">$duration</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="c1">// MediaWiki 1.22+</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">expiryParams</span><span class="p">(</span> <span class="nv">$expiry</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="c1">// MediaWiki 1.22+</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">timeperiodParams</span><span class="p">(</span> <span class="nv">$period</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="c1">// MediaWiki 1.22+</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">sizeParams</span><span class="p">(</span> <span class="nv">$size</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="c1">// MediaWiki 1.22+</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;msg&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">bitrateParams</span><span class="p">(</span> <span class="nv">$bitrate</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span> <span class="c1">// MediaWiki 1.22+</span> </pre></div> <dl><dt><code>params()</code></dt> <dd>Normal message substitution parameter.</dd> <dt><code>rawParams()</code></dt> <dd>Substitutes the parameter after the message has been otherwise processed; this means that these parameters are not available to parser functions, nor are they escaped if escaping output format is used (see below). Make sure you escape them properly yourself.</dd> <dt><code>plaintextParams()</code></dt> <dd>Like <code>rawParams()</code>, but does escaping. It is useful when you pass user input that may contain wikitext that should not be parsed.</dd></dl> <p>Each function from the second group formats the value in a specific way before the substitution. <code>numParams()</code> must be used if the message uses <code>{{PLURAL:}}</code>. In some cases you might not want to use it even though you have a number, for example a revision ID. The other functions correspond to Language functions <code>formatDuration</code>, <code>formatExpiry</code>, <code>formatTimePeriod</code>, <code>formatSize</code> and <code>formatBitrate</code>, and are just shorthands for calling them directly. </p><p><br /> </p> <div class="mw-heading mw-heading3"><h3 id="Language">Language</h3></div> <p>To override the language in which you want the message, there is one method and one shortcut for the common case of using wiki content language. In the latter case you can use either a language code or a language object. The usual language fallback chains apply, so the actual message you get may be in a different language than requested, if a translation does not exist. </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;message-key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">inContentLanguage</span><span class="p">();</span> <span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;message-key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">inLanguage</span><span class="p">(</span> <span class="nv">$lang</span> <span class="p">);</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Output_modes_and_escaping">Output modes and escaping</h3></div> <p>The Message class, and thus the object returned by wfMessage(), has five output modes: </p> <ul><li><code>plain()</code> - returns the message text as-is; only parameters are substituted<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup></li> <li><code>text()</code> - transforms the message text (see <code>MessageCache::transform()</code>) which transforms all <code>{{}}</code> including templates and parser functions like PLURAL and GENDER, but neither escapes nor sanitizes</li> <li><code>escaped()</code> - same as 'text', but also escapes it for use in HTML</li> <li><code>parse()</code> - parses the message text from wikitext to HTML and sanitizes (MessageCache::parse() which calls the Parser)</li> <li><code>parseAsBlock()</code> - the output is wrapped in a block level HTML element, if not already, similarly to OutputPage::addWikiMsg</li></ul> <p>Remember that <a href="/wiki/Special:MyLanguage/manual:Html.php" title="Special:MyLanguage/manual:Html.php">Html::</a> functions escape everything fed into them, so use the text() format with those to avoid double escaping. Hence the most common output format is text(). Also, make sure to use parse() or parseAsBlock() if the message has wikitext in it, otherwise the wikitext will just be escaped and output as plain text. </p><p>When using <code>wfMessage()</code> or <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">()</span></code>, you should always specify an output type. <code>text()</code> is appropriate when you're outputting it through <code>addWikiText()</code>. </p> <div class="mw-heading mw-heading4"><h4 id="Which_output_mode_to_use">Which output mode to use</h4></div> <p>Generally speaking, the most common modes you will use are <code>-&gt;parse()</code> and <code>-&gt;text()</code>. You use -&gt;parse() in most places where html markup is supported, and you use <code>-&gt;text()</code> in places where the content is going to become html escaped or html markup is not supported. </p><p>Some common cases: </p> <ul><li>If you are putting the message in the text part (third argument) of <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Html</span><span class="o">::</span><span class="na">element</span></code> use <code>-&gt;text()</code>. You may also consider using <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Html</span><span class="o">::</span><span class="na">rawElement</span><span class="p">()</span></code> instead and using the <code>-&gt;parse()</code> mode.</li> <li>If you are putting in text (third argument) of <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Html</span><span class="o">::</span><span class="na">rawElement</span><span class="p">()</span></code>, you should generally use <code>-&gt;parse()</code>.</li> <li>If you are putting into the attributes (second argument) of <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Html</span><span class="o">::</span><span class="na">rawElement</span><span class="p">()</span></code> or <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Html</span><span class="o">::</span><span class="na">element</span><span class="p">()</span></code>, use <code>-&gt;parse()</code></li> <li>If you are manually constructing html attributes, you should use <code>-&gt;escaped()</code>. However you should never manually construct html attributes</li> <li>For <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$out</span><span class="o">-&gt;</span><span class="na">addWikiText</span><span class="p">()</span></code> where <code>$out</code> is an OutputPage object use <code>-&gt;text()</code> or <code>-&gt;plain()</code>. However consider if you would rather use <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$out</span><span class="o">-&gt;</span><span class="na">addWikiMsg</span></code> instead.</li> <li>For $out-&gt;addHTML() use <code>-&gt;parse()</code></li></ul> <p><span class="anchor" id="Chaining"></span> </p> <div class="mw-heading mw-heading3"><h3 id="Method_chaining">Method chaining</h3></div> <p>Most Message methods return the current object, so you can conveniently call one after another to operate on an object before finally returning its text. This is called <b>method chaining</b>. Here is an example: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span> <span class="o">-&gt;</span><span class="na">params</span><span class="p">(</span> <span class="s1">&#39;apple&#39;</span> <span class="p">)</span> <span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="nv">$numOfApples</span> <span class="p">)</span> <span class="o">-&gt;</span><span class="na">setContext</span><span class="p">(</span> <span class="nv">$context</span> <span class="p">)</span> <span class="o">-&gt;</span><span class="na">inContentLanguage</span><span class="p">()</span> <span class="o">-&gt;</span><span class="na">parse</span><span class="p">()</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Additional_methods_of_printing_messages">Additional methods of printing messages</h3></div> <p>The general message function in MediaWiki is <code>wfMessage</code>. However, since in a message the value of magic words can depend on the context, there are various wrappers to this function, that automatically set the correct context. </p><p><b>OutputPage</b> has a few methods that append directly to the generated output. The useful ones are: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$out</span><span class="o">-&gt;</span><span class="na">addWikiMsg</span><span class="p">(</span> <span class="s1">&#39;pageheader&#39;</span> <span class="p">);</span> <span class="nv">$out</span><span class="o">-&gt;</span><span class="na">wrapWikiMsg</span><span class="p">(</span> <span class="s1">&#39;&lt;div class=&quot;error&quot;&gt;\n$1\n&lt;/div&gt;&#39;</span><span class="p">,</span> <span class="p">[</span> <span class="s1">&#39;someerrormessage&#39;</span><span class="p">,</span> <span class="nv">$user</span><span class="o">-&gt;</span><span class="na">getName</span><span class="p">()</span> <span class="p">]</span> <span class="p">);</span> </pre></div> <p>Both of the above parse the wikitext in the context of the current page before appending it to output buffer. </p><p>Classes extending <b>ContextSource</b> have a method <code>msg</code> that automatically sets the current context (language, current page etc.). It is therefore recommended to use <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">()</span></code> for those classes, like <b>special pages</b>. Here is a non-exhaustive list of such classes:<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup> </p> <ul><li>CategoryViewer</li> <li>HTMLForm</li> <li>LogEventsList</li> <li>DifferenceEngine</li> <li>OutputPage</li> <li>IndexPager</li> <li>ImageHistoryList</li> <li>ApiBase</li> <li>ChangesList</li> <li>Skin</li></ul> <table class="warning-message" style="background-color: var( --background-color-error-subtle, #ffe9e5 ); color: var( --color-base, #202122 ); border: 1px var( --border-color-error, #9f3526 ) solid; box-sizing: border-box; margin: 0.5em 0; padding: 0.5em;"><tbody><tr><td style="white-space: nowrap; vertical-align: top;"><span style="position: relative; top: -2px;"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/18px-OOjs_UI_icon_notice-destructive.svg.png" decoding="async" width="18" height="18" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/27px-OOjs_UI_icon_notice-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/36px-OOjs_UI_icon_notice-destructive.svg.png 2x" data-file-width="20" data-file-height="20" /></span></span></span> <b>Warning:</b> </td><td style="padding-left: 0.5em vertical-align: top;">The QuickTemplate class and its subclasses (BaseTemplate) have a method named <code>msg</code> which is different from the one from ContextSource. In these classes $this-&gt;msg() will simply output the escaped text of the message.</td></tr></tbody></table> <p>Examples of <b>correct</b> usage: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="mi">567</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">();</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="mi">567</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">parse</span><span class="p">();</span> </pre></div> <p>Examples of <b>incorrect</b> usage: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="mi">345</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">parseInline</span><span class="p">();</span> <span class="c1"># Number is not formatted correctly</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="mi">345</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">numParams</span><span class="p">(</span> <span class="mi">234</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">()</span> <span class="c1"># Plural syntax is not converted in plain format</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="Using_messages_in_JavaScript">Using messages in JavaScript</h2></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="/wiki/ResourceLoader/Core_modules#mw.message" title="ResourceLoader/Core modules">ResourceLoader/Core modules#mediaWiki.message</a></div> <dl><dd><style data-mw-deduplicate="TemplateStyles:r6651107">.mw-parser-output .note{background-position:left 7px top 50%;padding:0.5em 0.5em 0.5em 40px;margin:0.5em 0;overflow:hidden;background-color:#f8f9fa;color:#333;background-repeat:no-repeat;border:1px solid #ddd}.mw-parser-output .note-inline{display:inline-block;vertical-align:middle}.mw-parser-output .note-info{background-color:#eaf3ff;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/e/ec/OOjs_UI_icon_information-progressive.svg");background-size:25px;border-color:#a3caff;padding-left:40px;min-height:25px}.mw-parser-output .note-reminder{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/a/a8/OOjs_UI_icon_lightbulb-yellow.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-warn{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/3/3b/OOjs_UI_icon_alert-warning.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-error{background-color:#fee7e6;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/b/bf/OOjs_UI_icon_notice-destructive.svg");background-size:25px;border-color:#c33;min-height:25px}@media screen{html.skin-theme-clientpref-night .mw-parser-output .note{background-color:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .note{background-color:transparent;color:inherit}}</style><div role="note" class="note note-info">This page only deals with MediaWiki core. See the specific documentation instead for the <a rel="nofollow" class="external text" href="https://github.com/wikimedia/jquery.i18n#jqueryi18n"><b>jquery.i18n</b></a> module.</div></dd></dl> <div class="mw-heading mw-heading3"><h3 id="Getting_the_messages_to_the_client">Getting the messages to the client</h3></div> <p>To use the messages, we need to make sure that the messages are available at client side first. This can be done using either a ResourceLoader module (most common) or an API query from JavaScript (rare). </p> <div class="mw-heading mw-heading4"><h4 id="Using_a_ResourceLoader_module">Using a ResourceLoader module</h4></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6353907"><div role="note" class="hatnote mw-tpl-seealso">See also&#58; <a href="/wiki/Special:MyLanguage/Manual:$wgResourceModules" title="Special:MyLanguage/Manual:$wgResourceModules">Manual:$wgResourceModules</a></div> <dl><dd><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">This is the most common method of delivering messages. You should use this unless you have a good reason not to.</div></dd></dl> <p>We are going to use <a href="/wiki/Special:MyLanguage/ResourceLoader" title="Special:MyLanguage/ResourceLoader">ResourceLoader</a> to make sure that the messages are available at the client side. For this, in your ResourceLoader modules, define the messages to be exported to the client side. </p><p>If you plan to use the <code>mw.message(…).parse()</code> to generate HTML from wikitext in interface messages, then it is important to load the <a href="/wiki/Special:MyLanguage/ResourceLoader/Core_modules#mediawiki.jqueryMsg" title="Special:MyLanguage/ResourceLoader/Core modules">mediawiki.jqueryMsg</a> module. </p><p>Example (extension.json): </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;ResourceModules&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;ext.abuseFilter.edit&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;ext.abuseFilter.edit.js&quot;</span><span class="p">,</span> <span class="w"> </span><span class="nt">&quot;messages&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">&quot;abusefilter-edit-syntaxok&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;abusefilter-edit-syntaxerr&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;abusefilter-http-error&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;abusefilter-edit-throttle-placeholder&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;abusefilter-edit-tag-placeholder&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;abusefilter-edit-warn-leave&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;unknown-error&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;jan&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;feb&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;mar&quot;</span> <span class="w"> </span><span class="p">],</span> <span class="w"> </span><span class="nt">&quot;dependencies&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">&quot;mediawiki.util&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;mediawiki.api&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;mediawiki.confirmCloseWindow&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;jquery.textSelection&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;jquery.spinner&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;oojs-ui-core&quot;</span><span class="p">,</span> <span class="w"> </span><span class="s2">&quot;oojs-ui-widgets&quot;</span> <span class="w"> </span><span class="p">]</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Using_an_API_query_from_JavaScript">Using an API query from JavaScript</h4></div> <dl><dd><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">This is not a common way of loading messages. You should only use this if there is a good reason why you can't use <a href="#Using_a_ResourceLoader_module">the ResourceLoader module method above</a>.</div></dd></dl> <p>You can use the following code: <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r4199130"> </p> <table class="mw-version mw-version-ltr mw-version-version mw-version-version-unsupported mw-version-and-later"><tbody><tr> <td>MediaWiki version:</td> <td class="mw-version-versionbox" title="The latest stable version is 1.42"><div class="mw-version-versionnumber"><small>&#8805;</small> 1.27</div></td> </tr></tbody></table> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// When: The &#39;mediawiki.api&#39; module is loaded, and, the page is ready</span> <span class="nx">$</span><span class="p">.</span><span class="nx">when</span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">loader</span><span class="p">.</span><span class="nx">using</span><span class="p">(</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s1">&#39;mediawiki.api&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;mediawiki.jqueryMsg&#39;</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">),</span><span class="w"> </span><span class="nx">$</span><span class="p">.</span><span class="nx">ready</span><span class="w"> </span><span class="p">)</span> <span class="w"> </span><span class="c1">// Then: Load the messages that you need (if they are not yet loaded)</span> <span class="w"> </span><span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="kd">function</span><span class="p">()</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">Api</span><span class="p">().</span><span class="nx">loadMessagesIfMissing</span><span class="p">(</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s1">&#39;january&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;february&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;march&#39;</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">);</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span> <span class="w"> </span><span class="c1">// Then: Do stuff with them</span> <span class="w"> </span><span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="nx">doStuff</span><span class="w"> </span><span class="p">);</span> </pre></div> <p>To get the messages in some language other than the <code>UserLanguage</code> language, use getMessages instead of loadMessagesIfMissing, and supply the target language as the "amlang" field of the optional second parameter, like so: </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// When: The &#39;mediawiki.api&#39; module is loaded. No need to wait for the page to be ready.</span> <span class="nx">$</span><span class="p">.</span><span class="nx">when</span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">loader</span><span class="p">.</span><span class="nx">using</span><span class="p">(</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s1">&#39;mediawiki.api&#39;</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">)</span> <span class="w"> </span><span class="c1">// Then: get some messages in French (language code &#39;fr&#39;)</span> <span class="w"> </span><span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="kd">function</span><span class="p">()</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">Api</span><span class="p">().</span><span class="nx">getMessages</span><span class="p">(</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="s1">&#39;january&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;february&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;march&#39;</span><span class="w"> </span><span class="p">],</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">amlang</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;fr&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">);</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span> <span class="w"> </span><span class="c1">// Then: Do stuff with them</span> <span class="w"> </span><span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="w"> </span><span class="nx">doStuff</span><span class="w"> </span><span class="p">);</span> <span class="c1">// doStuff is a function that will receive as its first parameter an object that looks like so:</span> <span class="c1">// { february: &quot;février&quot;, january: &quot;janvier&quot;, march: &quot;mars&quot; }</span> </pre></div> <p><br /> </p> <div class="mw-heading mw-heading3"><h3 id="Use_of_the_messages">Use of the messages</h3></div> <p>The messages defined in the above example will be available at client side and can be accessed by <code>mw.message( 'message-key-name' )</code>. </p><p>For example: </p> <pre>$( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'&lt;div&gt;'</span></span> ).<span style="background-color: #ffb6db;">text</span>( mw.message( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'translate-msggroupselector-projects'</span></span> ).<span style="background-color: #6db6ff;">text</span>() ); </pre> <p>Note how we use jQuery <code><span style="background-color: #ffb6db;">text</span></code> method to escape our output properly when using mw.message <code><span style="background-color: #6db6ff;">text</span></code> format. </p><p>If your message contains wikitext formatting, you can instead use the following: </p> <pre>$( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'&lt;div&gt;'</span></span> ).<span style="background-color: #ffb6db;">append</span>( mw.message( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'translate-msggroupselector-projects'</span></span> ).<span style="background-color: #6db6ff;">parseDom</span>() ); </pre> <p>Here we use jQuery <code><span style="background-color: #ffb6db;">append</span></code> method to insert the DOM nodes returned by mw.message <code><span style="background-color: #6db6ff;">parseDom</span></code> format. </p><p>In older code you might also encounter the following: (<code>parseDom</code> was not available until MediaWiki 1.27) </p> <pre>$( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'&lt;div&gt;'</span></span> ).<span style="background-color: #ffb6db;">html</span>( mw.message( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'translate-msggroupselector-projects'</span></span> ).<span style="background-color: #6db6ff;">escaped</span>() ); $( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'&lt;div&gt;'</span></span> ).<span style="background-color: #ffb6db;">html</span>( mw.message( <span class="mw-highlight mw-highlight-lang-js"><span class="s1">'translate-msggroupselector-projects'</span></span> ).<span style="background-color: #6db6ff;">parse</span>() ); </pre> <p>There are other correct combinations, but whenever possible, stick to the patterns above to avoid XSS vulnerabilities and make your code easier to understand for others. </p><p>We can also pass the dynamic parameters to the message (i.e. the values for $1, $2, etc.) as shown below. </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">$</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;&lt;div&gt;&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;hello-user&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">username</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">()</span><span class="w"> </span><span class="p">);</span> </pre></div> <p>In the above examples, note that the message should be defined in an i18n file. If the message key is not found in any i18n file, the result will be the message key in curved angle brackets U+29FC/U+29FD (part of mathematical symbols), like '⧼message-key-foo⧽'. In older versions of MediaWiki, the message key was returned in ASCII angle brackets, like '&lt;message-key-foo&gt;', and this could generate invalid or fake HTML elements. In the case where the message key does not exists, the <code>.exists()</code> method of the returned message object will also return false instead of true. </p><p>To use a message that must not go through the parser (e.g. when passing JSON data as messages, or when the message will be used as <a href="/wiki/Special:MyLanguage/Manual:Creating_pages_with_preloaded_text" title="Special:MyLanguage/Manual:Creating pages with preloaded text">preloaded text</a> of a page), use: </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;foobar&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">plain</span><span class="p">()</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Format_options">Format options</h4></div> <p>If you don't specify the output format, mw.message just returns a Message object. To output the message itself, you should specify an output format. The formats are mostly the same as in PHP side: </p> <ul><li><code>mw.message( 'foobar' ).plain()</code> Returns the message text as-is; only parameters are substituted.</li> <li><code>mw.message( 'foobar' ).text()</code> Transforms the message text (all supported <code>{{}}</code> blocks are replaced with transformed results). See <a href="#Feature_support_in_JavaScript">#Feature support in JavaScript</a> for details of what is supported. For example, certain keywords (<code>{{int:}}</code> (but only without parameters), <code>{{GENDER}}</code>, <code>{{SITENAME}}</code> etc.) work, but tranclusion (e.g. <code>{{MediaWiki:}}</code>) and server-side <a href="/wiki/Special:MyLanguage/Help:Magic_words" title="Special:MyLanguage/Help:Magic words">Magic words</a> such as {{NUMBEROFEDITS}} or {{ns:Project}} do not work,</li> <li><code>mw.message( 'foobar' ).escaped()</code> HTML escaped version of <code>text</code>.</li> <li><code>mw.message( 'foobar' ).parse()</code> Parses the message text from wikitext to HTML. This supports everything from <code>text</code> mode, as well as most links, and allow listed HTML.</li> <li><code>mw.message( 'foobar' ).parseDom()</code> Like <code>parse()</code>, but returns a jQuery collection instead of a HTML string.</li></ul> <table class="warning-message" style="background-color: var( --background-color-error-subtle, #ffe9e5 ); color: var( --color-base, #202122 ); border: 1px var( --border-color-error, #9f3526 ) solid; box-sizing: border-box; margin: 0.5em 0; padding: 0.5em;"><tbody><tr><td style="white-space: nowrap; vertical-align: top;"><span style="position: relative; top: -2px;"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/18px-OOjs_UI_icon_notice-destructive.svg.png" decoding="async" width="18" height="18" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/27px-OOjs_UI_icon_notice-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/36px-OOjs_UI_icon_notice-destructive.svg.png 2x" data-file-width="20" data-file-height="20" /></span></span></span> <b>Warning:</b> </td><td style="padding-left: 0.5em vertical-align: top;">If the mediawiki.jqueryMsg module is not loaded, all of the above methods behave essentially like <code>plain()</code> with possible escaping.</td></tr></tbody></table> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">There is no equivalent of parseAsBlock. Where necessary, wrap the output in a block element yourself.</div> <div class="mw-heading mw-heading4"><h4 id="Parameters_2">Parameters</h4></div> <p>Parameters can be specified as additional arguments to <code>mw.message()</code>. They can be passed as strings or as DOM nodes / jQuery collections. </p><p>Unlike in PHP, wikitext in the parameters is <i>not parsed</i>. Effectively, all string parameters behave like <code>plaintextParams()</code>. </p><p>DOM/jQuery parameters can be used to achieve the equivalent of <code>rawParams()</code>. </p><p>There is no support for other parameter formats. Instead of <code>numParams()</code>, you must format numbers before passing them as parameters, using <code>mw.language.convertNumber()</code>. </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">$</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;&lt;div&gt;&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">(</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;translate-msggroupselector-view-subprojects&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">language</span><span class="p">.</span><span class="nx">convertNumber</span><span class="p">(</span><span class="w"> </span><span class="nx">count</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">()</span><span class="w"> </span><span class="p">);</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Feature_support_in_JavaScript">Feature support in JavaScript</h3></div> <table class="warning-message" style="background-color: var( --background-color-error-subtle, #ffe9e5 ); color: var( --color-base, #202122 ); border: 1px var( --border-color-error, #9f3526 ) solid; box-sizing: border-box; margin: 0.5em 0; padding: 0.5em;"><tbody><tr><td style="white-space: nowrap; vertical-align: top;"><span style="position: relative; top: -2px;"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/18px-OOjs_UI_icon_notice-destructive.svg.png" decoding="async" width="18" height="18" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/27px-OOjs_UI_icon_notice-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/36px-OOjs_UI_icon_notice-destructive.svg.png 2x" data-file-width="20" data-file-height="20" /></span></span></span> <b>Warning:</b> </td><td style="padding-left: 0.5em vertical-align: top;">Wikitext support in JS messages requires the <i>mediawiki.jqueryMsg</i> module to be loaded, otherwise these features will be silently ignored.</td></tr></tbody></table> <p>JavaScript messages only support a small subset of wikitext syntax. Supported features include: </p> <ul><li>Internal links (except <a href="/wiki/Special:MyLanguage/pipe_trick" title="Special:MyLanguage/pipe trick">pipe trick</a>)</li> <li>Explicit external links (no auto-numbered and free links)</li> <li>The magic words SITENAME, PAGENAME, PAGENAMEE; since MW 1.38: SERVERNAME; since MW 1.43: CONTENTLANGUAGE</li> <li>The parser functions PLURAL, GENDER, GRAMMAR, int, ns, formatnum, lc, uc, lcfirst, ucfirst; since MW 1.44: fullurl</li> <li>HTML tags which are allowed in wikitext (HTML must be well-formed)</li> <li>HTML entities <code>&amp;#039;</code>, <code>&amp;quot;</code>, <code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code></li> <li>The <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">nowiki</span><span class="p">&gt;</span></code> tag</li></ul> <p>Notable wikitext syntax that is <b>not</b> supported: </p> <ul><li>Templates</li> <li><a href="https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Interwiki_linking#Non-local_interwikis" class="extiw" title="metawiki:Special:MyLanguage/Help:Interwiki linking">Non-local interwiki links</a></li> <li>All other parser functions and magic words</li> <li>Modules (for example <a href="/wiki/Special:MyLanguage/Module:String" title="Special:MyLanguage/Module:String">Module:String</a>)</li> <li>All other XML-like tags (extension tags)</li> <li>Bold and italic <code>'''</code>, <code>''</code> (use <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">b</span><span class="p">&gt;</span></code>, <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">i</span><span class="p">&gt;</span></code> instead)</li> <li>Lists using <code>*</code>, <code>#</code> (use <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">ul</span><span class="p">&gt;</span></code> or <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">ol</span><span class="p">&gt;</span></code>, <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">li</span><span class="p">&gt;</span></code> instead)</li> <li>Definition lists / indents using <code>;</code>, <code>:</code> (use <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">dl</span><span class="p">&gt;</span></code>, <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">dt</span><span class="p">&gt;</span></code>, <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">dd</span><span class="p">&gt;</span></code> instead)</li> <li>Multiple paragraphs (use <code class="mw-highlight" style="white-space:nowrap"><span class="p">&#8206;&lt;</span><span class="nt">p</span><span class="p">&gt;</span></code> instead)</li> <li>Self-closing HTML tags</li> <li>Comments <code class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><span class="cm">&lt;!-- --&gt;</span></code></li> <li>Some types of nesting (e.g. <code class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr">{{PLURAL:$1|<span class="p">&lt;</span><span class="nt">strong</span><span class="p">&gt;</span>$1<span class="p">&lt;/</span><span class="nt">strong</span><span class="p">&gt;</span>}}</code>)</li></ul> <p>The <a href="https://translatewiki.net/wiki/Template:Doc-jqueryMsg" class="extiw" title="translatewiki:Template:Doc-jqueryMsg">doc-jqueryMsg template</a> can be used to <a href="/wiki/Special:MyLanguage/Help:System_message#Message_documentation" title="Special:MyLanguage/Help:System message">document</a> such messages, to let translators know which wikitext restrictions apply. </p> <div class="mw-heading mw-heading3"><h3 id="mw.msg">mw.msg</h3></div> <p>The <code>mw.msg()</code> function is commonly used as a shortcut for <code>mw.message().text()</code>. </p> <div class="mw-heading mw-heading3"><h3 id="Exporting_messages_through_ResourceLoader_callbacks">Exporting messages through ResourceLoader callbacks</h3></div> <p>If you need to process a message on the server and send the result to the client (e.g. because you need to parse the message using parsing features that aren't supported in JS), you can do that with a <a href="/wiki/ResourceLoader/Package_files#Generated_content" title="ResourceLoader/Package files">package files callback</a> in your ResourceLoader module. When you do this, take care to use <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nv">$context</span><span class="o">-&gt;</span><span class="na">msg</span><span class="p">()</span></code>, because using <code>wfMessage()</code> will <a href="/wiki/Special:MyLanguage/ResourceLoader/Package_files#Common_pitfall:_using_i18n_messages_in_generated_content_callbacks" title="Special:MyLanguage/ResourceLoader/Package files">cause errors</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Using_messages_in_Lua">Using messages in Lua</h2></div> <p>Modules written in Lua using <a href="/wiki/Special:MyLanguage/Extension:Scribunto" title="Special:MyLanguage/Extension:Scribunto">Scribunto</a><span style="display:none"><a href="/wiki/Extension:Scribunto" title="Extension:Scribunto"> </a></span> run similarly to templates and have access to MediaWiki messages. The MediaWiki Lua library includes the mw.message class for processing messages. Refer to the full <a href="/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual#Message_library" title="Special:MyLanguage/Extension:Scribunto/Lua reference manual">Lua message library</a> documentation for the full API. Here is a simple example: </p> <div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">local</span> <span class="n">p</span> <span class="o">=</span> <span class="p">{}</span> <span class="kr">function</span> <span class="nc">p</span><span class="p">.</span><span class="nf">nmembers</span><span class="p">(</span> <span class="n">frame</span> <span class="p">)</span> <span class="kd">local</span> <span class="n">nmembersMsg</span> <span class="o">=</span> <span class="n">mw</span><span class="p">.</span><span class="n">message</span><span class="p">.</span><span class="n">new</span><span class="p">(</span> <span class="s1">&#39;nmembers&#39;</span> <span class="p">)</span> <span class="n">nmembersMsg</span><span class="p">:</span><span class="n">numParams</span><span class="p">(</span> <span class="mi">3</span> <span class="p">)</span> <span class="c1">-- This ensures number localization</span> <span class="c1">-- Show the message in the language of the wiki. frame:preprocess expands the {{plural}} clause.</span> <span class="kr">return</span> <span class="n">frame</span><span class="p">:</span><span class="n">preprocess</span><span class="p">(</span> <span class="n">nmembersMsg</span><span class="p">:</span><span class="n">plain</span><span class="p">()</span> <span class="p">)</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="Notes_about_gender,_grammar,_plural"><span id="Notes_about_gender.2C_grammar.2C_plural"></span>Notes about gender, grammar, plural</h2></div> <dl><dd>See also <a href="#Switches_in_messages…">#Switches in messages…</a>; the syntax itself is documented at <a href="/wiki/Special:MyLanguage/Help:Magic_words#Localization" title="Special:MyLanguage/Help:Magic words">Help:Magic words#Localization</a> and related.</dd></dl> <p>In general, GENDER, GRAMMAR and PLURAL magic words work identically in both PHP and JavaScript sides. </p> <ol><li>You must use <code>text</code>, <code>escaped</code>, <code>parse</code> or <code>parseAsBlock</code> <a href="#Output_modes_and_escaping">output formats</a> for them to work. <ul><li>In PHP, you can use wfMessage or <code><a href="#Additional_methods_of_printing_messages">$this-&gt;msg</a></code>.</li> <li>In JavaScript, make sure your resource loader module depends on <code>jqueryMsg</code> (see <a href="#Using_messages_in_JavaScript">#Using messages in JavaScript</a>).</li></ul></li> <li>You need to pass the relevant parameter as normal parameter to the message. <ul><li>The parameter is the number for PLURAL; the plain text or wikitext-escaped username for GENDER in PHP; the gender from preferences or a user object for GENDER in JavaScript (<a href="#GENDER_in_JavaScript">see below</a>).</li> <li>For enabling plural and correct number localization in PHP, you need to use <code>numParams</code> for the number, see also <a href="#Chaining">#Chaining</a>.</li> <li>For enabling plural and correct number localization in JavaScript, you need to use <code>mw.language.convertNumber</code> for the number</li></ul></li></ol> <div class="mw-heading mw-heading3"><h3 id="PLURAL_syntax_example">PLURAL syntax example</h3></div> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="c1"># Simple plural</span> <span class="s1">&#39;key&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;$1 crying {{PLURAL:$1|baby|babies}}&#39;</span> </pre></div> <p><span class="anchor" id="JavaScript_examples"></span> </p> <div class="mw-heading mw-heading3"><h3 id="GENDER_in_JavaScript">GENDER in JavaScript</h3></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">This needs explicit <code>jqueryMsg</code>, see <a href="#Using_messages_in_JavaScript">#Using messages in JavaScript</a>.</div> <p>If you have a message, say, <code>"message-key-gender-foo": "{{GENDER:$1|he|she|they}} created an article"</code>, in JavaScript, you can use it as given below: </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;male&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span><span class="w"> </span><span class="c1">// returns &#39;he created an article&#39;</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;female&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span><span class="w"> </span><span class="c1">// returns &#39;she created an article&#39;</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;unknown&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span><span class="w"> </span><span class="c1">// returns &#39;they created an article&#39;</span> </pre></div> <p>Instead of passing the gender directly, we can pass any "User-like" object with a gender option. For example, the current user object <code>mw.user</code>. </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">var</span><span class="w"> </span><span class="nx">user</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">mw</span><span class="p">.</span><span class="nx">user</span><span class="p">;</span><span class="w"> </span><span class="c1">// current user</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">user</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span><span class="w"> </span><span class="c1">// The message returned will be based on the gender of the current user.</span> </pre></div> <p>If the gender passed is invalid or unknown, the gender neutral form will be used as defined for each language. Pass <code>'unknown'</code> if you intentionally want the neutral form. </p><p>Finally, if you want to use the gender of the current user, you can pass an empty string: </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// the following line illustrates the message content, you can run this snippet on developer console</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">messages</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;{{GENDER:$1|male|female|unknown}}&#39;</span><span class="w"> </span><span class="p">);</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">user</span><span class="p">.</span><span class="nx">options</span><span class="p">.</span><span class="nx">values</span><span class="p">.</span><span class="nx">gender</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">&#39;female&#39;</span><span class="p">;</span><span class="w"> </span><span class="c1">// temporarily manipulate your gender preference</span> <span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-gender-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span><span class="w"> </span><span class="c1">// return value depends on your gender preference</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="PLURAL_in_JavaScript">PLURAL in JavaScript</h3></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">This needs explicit <code>jqueryMsg</code>, see <a href="#Using_messages_in_JavaScript">#Using messages in JavaScript</a>.</div> <p>If you have a message, say <code> 'message-key-plural-foo' =&gt; 'There {{PLURAL:$1|is $1 item|are $1 items}}' </code> , in JavaScript, you can use it as given below: </p> <div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">mw</span><span class="p">.</span><span class="nx">message</span><span class="p">(</span><span class="w"> </span><span class="s1">&#39;message-key-plural-foo&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">count</span><span class="w"> </span><span class="p">).</span><span class="nx">text</span><span class="p">();</span> <span class="c1">// returns &#39;There is 1 item&#39; if count = 1</span> <span class="c1">// returns &#39;There are 6 items&#39; if count = 6</span> </pre></div> <p><span class="anchor" id="Deprecated_wfMsg*_functions"></span> </p> <div class="mw-heading mw-heading2"><h2 id="Help_with_replacing_deprecated_wfMsg*_functions"><span id="Help_with_replacing_deprecated_wfMsg.2A_functions"></span>Help with replacing deprecated wfMsg* functions</h2></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-error">These functions were removed <a href="https://gerrit.wikimedia.org/r/262333" class="extiw" title="gerrit:262333">starting with MediaWiki 1.27 LTS</a>.</div> <p>The code using these functions often has incorrect escaping and other code quality issues, so it's also recommended to </p> <ul><li>replace all Xml:: functions with their Html:: equivalents, which make it easier to do the right thing;<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup></li> <li>where possible, avoid globals and use <code>msg()</code> (see <a href="#Additional_methods_of_printing_messages">above</a>);</li> <li>replace <code>htmlspecialchars()</code> with <code>-&gt;escaped()</code> where appropriate.</li></ul> <table class="wikitable"> <tbody><tr> <th width="490px">Code change </th> <th>Description </th></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsg</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">();</span></code></dd></dl> </td> <td>&#160; </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgExt</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="nx">SOME_FORMAT</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">SOME_FORMAT_FUNCTION</span><span class="p">();</span></code></dd></dl> </td> <td>The second parameter specifies the output mode, usually expressed as an array like <code>array( 'escape' )</code> but sometimes just like <code>'escape'</code>: it needs to be replaced according to <a href="#Output_modes_and_escaping">#Output modes and escaping</a>, like <code>-&gt;escaped()</code>. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgExt</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;parse&#39;</span> <span class="p">),</span> <span class="s1">&#39;apple&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">parseAsBlock</span><span class="p">();</span></code></dd></dl> </td> <td>Use full parsing, and wrap the output in block-level HTML tags. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgExt</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;parseinline&#39;</span> <span class="p">),</span> <span class="s1">&#39;apple&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">parse</span><span class="p">();</span></code></dd></dl> </td> <td>Use full parsing. Parseinline is used because it is more useful when pre-building HTML. In normal use it is better to use OutputPage::(add|wrap)WikiMsg. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgExt</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;parsemag&#39;</span> <span class="p">),</span> <span class="s1">&#39;apple&#39;</span><span class="p">,</span> <span class="s1">&#39;pear&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span><span class="p">,</span> <span class="s1">&#39;pear&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">();</span></code></dd></dl> </td> <td>Places where HTML cannot be used. {{-transformation is done. </td></tr> <tr> <td>Instead of <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgHtml</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="s1">&#39;apple&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">rawParams</span><span class="p">(</span> <span class="s1">&#39;apple&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">escaped</span><span class="p">();</span></code></dd></dl> </td> <td><code>wfMsgHtml</code> does not escape parameters: to get the same result you need to use rawParams; check that the parameter really is safe for HTML output. If the message is then output as HTML, you must use <code>escaped()</code> for <a href="/wiki/Special:MyLanguage/Security_for_developers" title="Special:MyLanguage/Security for developers">security</a>: it will escape the parameters too and that's not always wanted, although it doesn't matter e.g. when the parameter is a number. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgForContent</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">inContentLanguage</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">text</span><span class="p">();</span></code></dd></dl> </td> <td>Get a message in the wiki's content language (<a href="/wiki/Special:MyLanguage/Manual:$wgLanguageCode" title="Special:MyLanguage/Manual:$wgLanguageCode">$wgLanguageCode</a><span style="display:none"><a href="/wiki/Manual:$wgLanguageCode" title="Manual:$wgLanguageCode"> </a></span>). </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgForContentNoTrans</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">inContentLanguage</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">plain</span><span class="p">();</span></code></dd></dl> </td> <td>Get a message in the wiki's content language (<a href="/wiki/Special:MyLanguage/Manual:$wgLanguageCode" title="Special:MyLanguage/Manual:$wgLanguageCode">$wgLanguageCode</a><span style="display:none"><a href="/wiki/Manual:$wgLanguageCode" title="Manual:$wgLanguageCode"> </a></span>) but don't transform the message. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfEmptyMsg</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span><span class="p">,</span> <span class="nv">$message</span> <span class="o">=</span> <span class="nx">wfMsgForContent</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMessage</span><span class="p">(</span> <span class="s1">&#39;key&#39;</span> <span class="p">)</span><span class="o">-&gt;</span><span class="na">inContentLanguage</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">isBlank</span><span class="p">();</span></code></dd></dl> </td> <td>Checks if the 'key' message in the wiki's content language is empty. Often, <code>isDisabled()</code> is a more appropriate check and should be used instead. </td></tr> <tr> <td>Instead of: <dl><dd><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">wfMsgReal</span><span class="p">(</span> <span class="nv">$error</span><span class="p">[</span><span class="s1">&#39;message&#39;</span><span class="p">],</span> <span class="nv">$error</span><span class="p">[</span><span class="s1">&#39;params&#39;</span><span class="p">]</span> <span class="p">);</span></code></dd></dl> <p>write: </p> <dl><dd><code>?</code></dd></dl> </td> <td>There is no simple replacement, depends on parameters. Should never have been used in the first place. </td></tr> <tr> <td>Instead of: <dl><dd><code>wfMsgGetKey</code></dd></dl> <p>write: </p> <dl><dd><code>?</code></dd></dl> </td> <td>There is no simple replacement, depends on parameters. Should never have been used in the first place. </td></tr></tbody></table> <p><br /> </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div> <ul><li><a href="/wiki/Special:MyLanguage/API:Allmessages" title="Special:MyLanguage/API:Allmessages">API:Allmessages</a><span style="display:none"><a href="/wiki/API:Allmessages" title="API:Allmessages"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Help:HTML_in_wikitext" title="Special:MyLanguage/Help:HTML in wikitext">Help:HTML in wikitext</a><span style="display:none"><a href="/wiki/Help:HTML_in_wikitext" title="Help:HTML in wikitext"> </a></span></li> <li><a class="external text" href="https://doc.wikimedia.org/mediawiki-core/master/php/classMessage.html">Message class documentation</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">While using this mode to display HTML content is possible, it is recommended to use wikitext and use the parse() mode to transform it into HTML.</span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">More in general, use $this-&gt;msg() in non-static functions of IContextSource objects.</span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">For instance Xml::tags() doesn't escape.</span> </li> </ol></div> <div class="navbox-styles nomobile"><style data-mw-deduplicate="TemplateStyles:r6230902">.mw-parser-output .navbox{border:1px solid #aaa;box-sizing:border-box;width:100%;margin:auto;clear:both;font-size:88%;text-align:center;padding:1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox th,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{text-align:center;padding-left:1em;padding-right:1em}.mw-parser-output th.navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background:#fdfdfd}.mw-parser-output .navbox-list{border-color:#fdfdfd}.mw-parser-output .navbox th,.mw-parser-output .navbox-title{background:#eaeeff}.mw-parser-output .navbox-abovebelow,.mw-parser-output th.navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background:#ddddff}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background:#e6e6ff}.mw-parser-output .navbox-even{background:#f7f7f7}.mw-parser-output .navbox-odd{background:transparent}.mw-parser-output th.navbox-title1{border-left:2px solid #fdfdfd;width:100%}.mw-parser-output td.navbox-list1{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .hlist dd,.mw-parser-output .navbox .hlist dt,.mw-parser-output .navbox .hlist li{white-space:nowrap}.mw-parser-output .navbox .hlist dd dl,.mw-parser-output .navbox .hlist dt dl,.mw-parser-output .navbox .hlist li ol,.mw-parser-output .navbox .hlist li ul{white-space:normal}.mw-parser-output ol+.navbox-styles+.navbox,.mw-parser-output ul+.navbox-styles+.navbox{margin-top:0.5em}</style></div><div role="navigation" class="navbox" aria-labelledby="Parser_functions" style="padding:3px"><table class="nowraplinks mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6387430"><style data-mw-deduplicate="TemplateStyles:r4692751">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar ul{display:inline;white-space:nowrap}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em;width:6em}</style><div class="plainlinks hlist navbar mini"><ul><li class="nv-view"><a href="/wiki/Template:Parser_functions_nav" title="Template:Parser functions nav"><abbr title="View this template" style=";;background:none transparent;border:none;box-shadow:none; padding:0;">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Parser_functions_nav" title="Template talk:Parser functions nav"><abbr title="Discuss this template" style=";;background:none transparent;border:none;box-shadow:none; padding:0;">t</abbr></a></li><li class="nv-edit"><a class="external text" href="https://www.mediawiki.org/w/index.php?title=Template:Parser_functions_nav&amp;action=edit"><abbr title="Edit this template" style=";;background:none transparent;border:none;box-shadow:none; padding:0;">e</abbr></a></li></ul></div><div id="Parser_functions" style="font-size:114%;margin:0 4em"><a href="/wiki/Special:MyLanguage/Manual:Parser_functions" title="Special:MyLanguage/Manual:Parser functions">Parser functions</a><span style="display:none"><a href="/wiki/Manual:Parser_functions" title="Manual:Parser functions"> </a></span></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%">All</th><td class="navbox-list1 navbox-list navbox-odd" style="width:100%;padding:0px;text-align: left;"><div style="padding:0em 0.25em"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6387430"><div class="hlist"> <ul><li><b>A</b>&#160;{{<a href="/wiki/Special:MyLanguage/anchorencode" title="Special:MyLanguage/anchorencode">#anchorencode</a><span style="display:none"><a href="/wiki/Anchorencode" class="mw-redirect" title="Anchorencode"> </a></span>}}</li> <li><b>B</b>&#160;{{<a href="/wiki/Special:MyLanguage/babel" title="Special:MyLanguage/babel">#babel</a><span style="display:none"><a href="/wiki/Babel" class="mw-redirect" title="Babel"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/basepagename" title="Special:MyLanguage/basepagename">#basepagename</a><span style="display:none"><a href="/wiki/Basepagename" class="mw-redirect" title="Basepagename"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/basepagenamee" title="Special:MyLanguage/basepagenamee">#basepagenamee</a><span style="display:none"><a href="/wiki/Basepagenamee" class="mw-redirect" title="Basepagenamee"> </a></span>}}</li> <li><b>C</b>&#160;{{<a href="/wiki/Special:MyLanguage/canonicalurl" class="new" title="Special:MyLanguage/canonicalurl (page does not exist)">#canonicalurl</a><span style="display:none"><a href="/w/index.php?title=Canonicalurl&amp;action=edit&amp;redlink=1" class="new" title="Canonicalurl (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/canonicalurle" class="new" title="Special:MyLanguage/canonicalurle (page does not exist)">#canonicalurle</a><span style="display:none"><a href="/w/index.php?title=Canonicalurle&amp;action=edit&amp;redlink=1" class="new" title="Canonicalurle (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/Extension:CategoryTree#The_categorytree_parser_function" title="Special:MyLanguage/Extension:CategoryTree">#categorytree</a><span style="display:none"><a href="/wiki/Extension:CategoryTree#The_categorytree_parser_function" title="Extension:CategoryTree"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/Extension:GeoData#Parser_function" title="Special:MyLanguage/Extension:GeoData">#coordinates</a><span style="display:none"><a href="/wiki/Extension:GeoData#Parser_function" title="Extension:GeoData"> </a></span>}}</li> <li><b>D</b>&#160;{{<a href="/wiki/Special:MyLanguage/defaultsort" class="new" title="Special:MyLanguage/defaultsort (page does not exist)">#defaultsort</a><span style="display:none"><a href="/w/index.php?title=Defaultsort&amp;action=edit&amp;redlink=1" class="new" title="Defaultsort (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/displaytitle" title="Special:MyLanguage/displaytitle">#displaytitle</a><span style="display:none"><a href="/wiki/Displaytitle" class="mw-redirect" title="Displaytitle"> </a></span>}}</li> <li><b>E</b>&#160;{{<a href="/wiki/Special:MyLanguage/expr" title="Special:MyLanguage/expr">#expr</a><span style="display:none"><a href="/wiki/Expr" class="mw-redirect" title="Expr"> </a></span>}}</li> <li><b>F</b>&#160;{{<a href="/wiki/Special:MyLanguage/filepath" class="new" title="Special:MyLanguage/filepath (page does not exist)">#filepath</a><span style="display:none"><a href="/w/index.php?title=Filepath&amp;action=edit&amp;redlink=1" class="new" title="Filepath (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/formatdate" title="Special:MyLanguage/formatdate">#formatdate</a><span style="display:none"><a href="/wiki/Formatdate" class="mw-redirect" title="Formatdate"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/formatnum" title="Special:MyLanguage/formatnum">#formatnum</a><span style="display:none"><a href="/wiki/Formatnum" class="mw-redirect" title="Formatnum"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/fullpagename" class="new" title="Special:MyLanguage/fullpagename (page does not exist)">#fullpagename</a><span style="display:none"><a href="/w/index.php?title=Fullpagename&amp;action=edit&amp;redlink=1" class="new" title="Fullpagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/fullpagenamee" class="new" title="Special:MyLanguage/fullpagenamee (page does not exist)">#fullpagenamee</a><span style="display:none"><a href="/w/index.php?title=Fullpagenamee&amp;action=edit&amp;redlink=1" class="new" title="Fullpagenamee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/fullurl" title="Special:MyLanguage/fullurl">#fullurl</a><span style="display:none"><a href="/wiki/Fullurl" class="mw-redirect" title="Fullurl"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/fullurle" class="new" title="Special:MyLanguage/fullurle (page does not exist)">#fullurle</a><span style="display:none"><a href="/w/index.php?title=Fullurle&amp;action=edit&amp;redlink=1" class="new" title="Fullurle (page does not exist)"> </a></span>}}</li> <li><b>G</b>&#160;{{<a href="/wiki/Special:MyLanguage/gender" title="Special:MyLanguage/gender">#gender</a><span style="display:none"><a href="/wiki/Gender" class="mw-redirect" title="Gender"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/grammar" class="new" title="Special:MyLanguage/grammar (page does not exist)">#grammar</a><span style="display:none"><a href="/w/index.php?title=Grammar&amp;action=edit&amp;redlink=1" class="new" title="Grammar (page does not exist)"> </a></span>}}</li> <li><b>I</b>&#160;{{<a href="/wiki/Special:MyLanguage/if" title="Special:MyLanguage/if">#if</a><span style="display:none"><a href="/wiki/If" class="mw-redirect" title="If"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/ifeq" title="Special:MyLanguage/ifeq">#ifeq</a><span style="display:none"><a href="/wiki/Ifeq" class="mw-redirect" title="Ifeq"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/iferror" title="Special:MyLanguage/iferror">#iferror</a><span style="display:none"><a href="/wiki/Iferror" class="mw-redirect" title="Iferror"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/ifexist" title="Special:MyLanguage/ifexist">#ifexist</a><span style="display:none"><a href="/wiki/Ifexist" class="mw-redirect" title="Ifexist"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/ifexpr" title="Special:MyLanguage/ifexpr">#ifexpr</a><span style="display:none"><a href="/wiki/Ifexpr" class="mw-redirect" title="Ifexpr"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/int" title="Special:MyLanguage/int">#int</a><span style="display:none"><a href="/wiki/Int" class="mw-redirect" title="Int"> </a></span>}}</li> <li>{{<a href="https://en.wikipedia.org/wiki/Wikipedia:Lua" class="extiw" title="w:Wikipedia:Lua">#invoke</a>}}</li> <li><b>L</b>&#160;{{<a href="/wiki/Special:MyLanguage/Help:Magic_words#Miscellaneous" title="Special:MyLanguage/Help:Magic words">#language</a><span style="display:none"><a href="/wiki/Help:Magic_words#Miscellaneous" title="Help:Magic words"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/Help:Magic_words#Formatting" title="Special:MyLanguage/Help:Magic words">#lc</a><span style="display:none"><a href="/wiki/Help:Magic_words#Formatting" title="Help:Magic words"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/lcfirst" title="Special:MyLanguage/lcfirst">#lcfirst</a><span style="display:none"><a href="/wiki/Lcfirst" class="mw-redirect" title="Lcfirst"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/localurl" title="Special:MyLanguage/localurl">#localurl</a><span style="display:none"><a href="/wiki/Localurl" class="mw-redirect" title="Localurl"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/localurle" class="new" title="Special:MyLanguage/localurle (page does not exist)">#localurle</a><span style="display:none"><a href="/w/index.php?title=Localurle&amp;action=edit&amp;redlink=1" class="new" title="Localurle (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/lqtpagelimit" class="new" title="Special:MyLanguage/lqtpagelimit (page does not exist)">#lqtpagelimit</a><span style="display:none"><a href="/w/index.php?title=Lqtpagelimit&amp;action=edit&amp;redlink=1" class="new" title="Lqtpagelimit (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/lst" title="Special:MyLanguage/lst">#lst</a><span style="display:none"><a href="/wiki/Lst" class="mw-redirect" title="Lst"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/lstx" title="Special:MyLanguage/lstx">#lstx</a><span style="display:none"><a href="/wiki/Lstx" class="mw-redirect" title="Lstx"> </a></span>}}</li> <li><b>N</b>&#160;{{<a href="/wiki/Special:MyLanguage/namespace" title="Special:MyLanguage/namespace">#namespace</a><span style="display:none"><a href="/wiki/Namespace" class="mw-redirect" title="Namespace"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/namespacee" class="new" title="Special:MyLanguage/namespacee (page does not exist)">#namespacee</a><span style="display:none"><a href="/w/index.php?title=Namespacee&amp;action=edit&amp;redlink=1" class="new" title="Namespacee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/namespacenumber" class="new" title="Special:MyLanguage/namespacenumber (page does not exist)">#namespacenumber</a><span style="display:none"><a href="/w/index.php?title=Namespacenumber&amp;action=edit&amp;redlink=1" class="new" title="Namespacenumber (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/ns" title="Special:MyLanguage/ns">#ns</a><span style="display:none"><a href="/wiki/Ns" class="mw-redirect" title="Ns"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/nse" class="new" title="Special:MyLanguage/nse (page does not exist)">#nse</a><span style="display:none"><a href="/w/index.php?title=Nse&amp;action=edit&amp;redlink=1" class="new" title="Nse (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberingroup" class="new" title="Special:MyLanguage/numberingroup (page does not exist)">#numberingroup</a><span style="display:none"><a href="/w/index.php?title=Numberingroup&amp;action=edit&amp;redlink=1" class="new" title="Numberingroup (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofactiveusers" class="new" title="Special:MyLanguage/numberofactiveusers (page does not exist)">#numberofactiveusers</a><span style="display:none"><a href="/w/index.php?title=Numberofactiveusers&amp;action=edit&amp;redlink=1" class="new" title="Numberofactiveusers (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofadmins" class="new" title="Special:MyLanguage/numberofadmins (page does not exist)">#numberofadmins</a><span style="display:none"><a href="/w/index.php?title=Numberofadmins&amp;action=edit&amp;redlink=1" class="new" title="Numberofadmins (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofarticles" class="new" title="Special:MyLanguage/numberofarticles (page does not exist)">#numberofarticles</a><span style="display:none"><a href="/w/index.php?title=Numberofarticles&amp;action=edit&amp;redlink=1" class="new" title="Numberofarticles (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofedits" class="new" title="Special:MyLanguage/numberofedits (page does not exist)">#numberofedits</a><span style="display:none"><a href="/w/index.php?title=Numberofedits&amp;action=edit&amp;redlink=1" class="new" title="Numberofedits (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberoffiles" class="new" title="Special:MyLanguage/numberoffiles (page does not exist)">#numberoffiles</a><span style="display:none"><a href="/w/index.php?title=Numberoffiles&amp;action=edit&amp;redlink=1" class="new" title="Numberoffiles (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofpages" class="new" title="Special:MyLanguage/numberofpages (page does not exist)">#numberofpages</a><span style="display:none"><a href="/w/index.php?title=Numberofpages&amp;action=edit&amp;redlink=1" class="new" title="Numberofpages (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofusers" class="new" title="Special:MyLanguage/numberofusers (page does not exist)">#numberofusers</a><span style="display:none"><a href="/w/index.php?title=Numberofusers&amp;action=edit&amp;redlink=1" class="new" title="Numberofusers (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/numberofviews" class="new" title="Special:MyLanguage/numberofviews (page does not exist)">#numberofviews</a><span style="display:none"><a href="/w/index.php?title=Numberofviews&amp;action=edit&amp;redlink=1" class="new" title="Numberofviews (page does not exist)"> </a></span>}}</li> <li><b>P</b>&#160;{{<a href="/wiki/Special:MyLanguage/padleft" title="Special:MyLanguage/padleft">#padleft</a><span style="display:none"><a href="/wiki/Padleft" class="mw-redirect" title="Padleft"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/padright" class="new" title="Special:MyLanguage/padright (page does not exist)">#padright</a><span style="display:none"><a href="/w/index.php?title=Padright&amp;action=edit&amp;redlink=1" class="new" title="Padright (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/pagename" class="new" title="Special:MyLanguage/pagename (page does not exist)">#pagename</a><span style="display:none"><a href="/w/index.php?title=Pagename&amp;action=edit&amp;redlink=1" class="new" title="Pagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/pagenamee" title="Special:MyLanguage/pagenamee">#pagenamee</a><span style="display:none"><a href="/wiki/Pagenamee" class="mw-redirect" title="Pagenamee"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/pagesincategory" title="Special:MyLanguage/pagesincategory">#pagesincategory</a><span style="display:none"><a href="/wiki/Pagesincategory" class="mw-redirect" title="Pagesincategory"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/pagesize" title="Special:MyLanguage/pagesize">#pagesize</a><span style="display:none"><a href="/wiki/Pagesize" class="mw-redirect" title="Pagesize"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/plural" class="new" title="Special:MyLanguage/plural (page does not exist)">#plural</a><span style="display:none"><a href="/w/index.php?title=Plural&amp;action=edit&amp;redlink=1" class="new" title="Plural (page does not exist)"> </a></span>}}</li> <li>{{<a href="https://www.wikidata.org/wiki/Wikidata:How_to_use_data_on_Wikimedia_projects" class="extiw" title="d:Wikidata:How to use data on Wikimedia projects">#property</a>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/protectionlevel" class="new" title="Special:MyLanguage/protectionlevel (page does not exist)">#protectionlevel</a><span style="display:none"><a href="/w/index.php?title=Protectionlevel&amp;action=edit&amp;redlink=1" class="new" title="Protectionlevel (page does not exist)"> </a></span>}}</li> <li><b>R</b>&#160;{{<a href="/wiki/Special:MyLanguage/rel2abs" class="new" title="Special:MyLanguage/rel2abs (page does not exist)">#rel2abs</a><span style="display:none"><a href="/w/index.php?title=Rel2abs&amp;action=edit&amp;redlink=1" class="new" title="Rel2abs (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/rootpagename" class="new" title="Special:MyLanguage/rootpagename (page does not exist)">#rootpagename</a><span style="display:none"><a href="/w/index.php?title=Rootpagename&amp;action=edit&amp;redlink=1" class="new" title="Rootpagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/rootpagenamee" class="new" title="Special:MyLanguage/rootpagenamee (page does not exist)">#rootpagenamee</a><span style="display:none"><a href="/w/index.php?title=Rootpagenamee&amp;action=edit&amp;redlink=1" class="new" title="Rootpagenamee (page does not exist)"> </a></span>}}</li> <li><b>S</b>&#160;{{<a href="/wiki/Special:MyLanguage/special" class="new" title="Special:MyLanguage/special (page does not exist)">#special</a><span style="display:none"><a href="/w/index.php?title=Special&amp;action=edit&amp;redlink=1" class="new" title="Special (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/speciale" class="new" title="Special:MyLanguage/speciale (page does not exist)">#speciale</a><span style="display:none"><a href="/w/index.php?title=Speciale&amp;action=edit&amp;redlink=1" class="new" title="Speciale (page does not exist)"> </a></span>}}</li> <li>{{<a href="https://www.wikidata.org/wiki/Wikidata:How_to_use_data_on_Wikimedia_projects" class="extiw" title="d:Wikidata:How to use data on Wikimedia projects">#statement</a>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subjectpagename" class="new" title="Special:MyLanguage/subjectpagename (page does not exist)">#subjectpagename</a><span style="display:none"><a href="/w/index.php?title=Subjectpagename&amp;action=edit&amp;redlink=1" class="new" title="Subjectpagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subjectpagenamee" class="new" title="Special:MyLanguage/subjectpagenamee (page does not exist)">#subjectpagenamee</a><span style="display:none"><a href="/w/index.php?title=Subjectpagenamee&amp;action=edit&amp;redlink=1" class="new" title="Subjectpagenamee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subjectspace" class="new" title="Special:MyLanguage/subjectspace (page does not exist)">#subjectspace</a><span style="display:none"><a href="/w/index.php?title=Subjectspace&amp;action=edit&amp;redlink=1" class="new" title="Subjectspace (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subjectspacee" class="new" title="Special:MyLanguage/subjectspacee (page does not exist)">#subjectspacee</a><span style="display:none"><a href="/w/index.php?title=Subjectspacee&amp;action=edit&amp;redlink=1" class="new" title="Subjectspacee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subpagename" class="new" title="Special:MyLanguage/subpagename (page does not exist)">#subpagename</a><span style="display:none"><a href="/w/index.php?title=Subpagename&amp;action=edit&amp;redlink=1" class="new" title="Subpagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/subpagenamee" class="new" title="Special:MyLanguage/subpagenamee (page does not exist)">#subpagenamee</a><span style="display:none"><a href="/w/index.php?title=Subpagenamee&amp;action=edit&amp;redlink=1" class="new" title="Subpagenamee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/switch" title="Special:MyLanguage/switch">#switch</a><span style="display:none"><a href="/wiki/Switch" class="mw-redirect" title="Switch"> </a></span>}}</li> <li><b>T</b>&#160;{{<a href="/wiki/Special:MyLanguage/tag_(parser_function)" title="Special:MyLanguage/tag (parser function)">#tag</a><span style="display:none"><a href="/wiki/Tag_(parser_function)" class="mw-redirect" title="Tag (parser function)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/talkpagename" class="new" title="Special:MyLanguage/talkpagename (page does not exist)">#talkpagename</a><span style="display:none"><a href="/w/index.php?title=Talkpagename&amp;action=edit&amp;redlink=1" class="new" title="Talkpagename (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/talkpagenamee" class="new" title="Special:MyLanguage/talkpagenamee (page does not exist)">#talkpagenamee</a><span style="display:none"><a href="/w/index.php?title=Talkpagenamee&amp;action=edit&amp;redlink=1" class="new" title="Talkpagenamee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/talkspace" title="Special:MyLanguage/talkspace">#talkspace</a><span style="display:none"><a href="/wiki/Talkspace" class="mw-redirect" title="Talkspace"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/talkspacee" class="new" title="Special:MyLanguage/talkspacee (page does not exist)">#talkspacee</a><span style="display:none"><a href="/w/index.php?title=Talkspacee&amp;action=edit&amp;redlink=1" class="new" title="Talkspacee (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/time" title="Special:MyLanguage/time">#time</a><span style="display:none"><a href="/wiki/Time" class="mw-redirect" title="Time"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/timel" class="new" title="Special:MyLanguage/timel (page does not exist)">#timel</a><span style="display:none"><a href="/w/index.php?title=Timel&amp;action=edit&amp;redlink=1" class="new" title="Timel (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/timef" title="Special:MyLanguage/timef">#timef</a><span style="display:none"><a href="/wiki/Timef" class="mw-redirect" title="Timef"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/timefl" class="new" title="Special:MyLanguage/timefl (page does not exist)">#timefl</a><span style="display:none"><a href="/w/index.php?title=Timefl&amp;action=edit&amp;redlink=1" class="new" title="Timefl (page does not exist)"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/titleparts" title="Special:MyLanguage/titleparts">#titleparts</a><span style="display:none"><a href="/wiki/Titleparts" class="mw-redirect" title="Titleparts"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/translation" title="Special:MyLanguage/translation">#translation</a><span style="display:none"><a href="/wiki/Translation" class="mw-disambig" title="Translation"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/translationdialog" class="new" title="Special:MyLanguage/translationdialog (page does not exist)">#translationdialog</a><span style="display:none"><a href="/w/index.php?title=Translationdialog&amp;action=edit&amp;redlink=1" class="new" title="Translationdialog (page does not exist)"> </a></span>}}</li> <li><b>U</b>&#160;{{<a href="/wiki/Special:MyLanguage/uc" title="Special:MyLanguage/uc">#uc</a><span style="display:none"><a href="/wiki/Uc" class="mw-redirect" title="Uc"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/ucfirst" title="Special:MyLanguage/ucfirst">#ucfirst</a><span style="display:none"><a href="/wiki/Ucfirst" class="mw-redirect" title="Ucfirst"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/urlencode" title="Special:MyLanguage/urlencode">#urlencode</a><span style="display:none"><a href="/wiki/Urlencode" class="mw-redirect" title="Urlencode"> </a></span>}}</li> <li>{{<a href="/wiki/Special:MyLanguage/useliquidthreads" class="new" title="Special:MyLanguage/useliquidthreads (page does not exist)">#useliquidthreads</a><span style="display:none"><a href="/w/index.php?title=Useliquidthreads&amp;action=edit&amp;redlink=1" class="new" title="Useliquidthreads (page does not exist)"> </a></span>}}</li></ul> </div></div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">See also</th><td class="navbox-list1 navbox-list navbox-even" style="width:100%;padding:0px;text-align: left;"><div style="padding:0em 0.25em"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6387430"><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Help:Extension:ParserFunctions" title="Special:MyLanguage/Help:Extension:ParserFunctions">Help:Extension:ParserFunctions</a><span style="display:none"><a href="/wiki/Help:Extension:ParserFunctions" title="Help:Extension:ParserFunctions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Help:Parser_functions_in_templates" title="Special:MyLanguage/Help:Parser functions in templates">Help:Parser functions in templates</a><span style="display:none"><a href="/wiki/Help:Parser_functions_in_templates" title="Help:Parser functions in templates"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Parser_extension_tags" title="Special:MyLanguage/Parser extension tags">Parser extension tags</a><span style="display:none"><a href="/wiki/Parser_extension_tags" title="Parser extension tags"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Parser_function_hooks" title="Special:MyLanguage/Parser function hooks">Parser function hooks</a><span style="display:none"><a href="/wiki/Parser_function_hooks" title="Parser function hooks"> </a></span></li></ul> </div></div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div><b><span class="plainlinks"><a class="external text" href="https://www.mediawiki.org/w/index.php?title=Special:Translate&amp;group=page-Template%3ATranslatable+modules+nav&amp;language=&amp;action=page&amp;filter=">Translate this navigation box</a></span></b></div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐6df7948d6c‐zmfbt Cached time: 20241127204102 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.700 seconds Real time usage: 1.008 seconds Preprocessor visited node count: 10823/1000000 Post‐expand include size: 162350/2097152 bytes Template argument size: 65169/2097152 bytes Highest expansion depth: 20/100 Expensive parser function count: 90/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 74748/5000000 bytes Lua time usage: 0.166/10.000 seconds Lua memory usage: 2415218/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 651.662 1 -total 44.94% 292.850 104 Template:Ll 40.35% 262.920 3 Template:Flatlist 35.48% 231.204 1 Template:Parser_functions_nav 34.78% 226.662 1 Template:Navbox 25.34% 165.163 208 Template:Translatable 23.15% 150.858 110 Template:Pagelang 17.00% 110.814 31 Template:Phpi 16.44% 107.160 31 Template:Inline-code 13.99% 91.177 1 Template:I18n_navigation --> <!-- Saved in parser cache with key mediawikiwiki:pcache:idhash:45493-0!canonical and timestamp 20241127204102 and revision id 6865557. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://www.mediawiki.org/w/index.php?title=Manual:Messages_API&amp;oldid=6865557">https://www.mediawiki.org/w/index.php?title=Manual:Messages_API&amp;oldid=6865557</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/wiki/Category:MediaWiki_code" title="Category:MediaWiki code">MediaWiki code</a></li><li><a href="/wiki/Category:Localisation" title="Category:Localisation">Localisation</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 23 November 2024, at 03:06.</li> <li id="footer-info-copyright">Text is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-ShareAlike License</a>; additional terms may apply. Text in <a class="external text" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">the Help: namespace</a> is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 License</a>. By using this site, you agree to the <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">Terms of Use</a> and <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy Policy</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Project:About">About mediawiki.org</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Project:General_disclaimer">Disclaimers</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/www.mediawiki.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//m.mediawiki.org/w/index.php?title=Manual:Messages_API&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-6b8d669998-9lqs2","wgBackendResponseTime":140,"wgPageParseReport":{"limitreport":{"cputime":"0.700","walltime":"1.008","ppvisitednodes":{"value":10823,"limit":1000000},"postexpandincludesize":{"value":162350,"limit":2097152},"templateargumentsize":{"value":65169,"limit":2097152},"expansiondepth":{"value":20,"limit":100},"expensivefunctioncount":{"value":90,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":74748,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 651.662 1 -total"," 44.94% 292.850 104 Template:Ll"," 40.35% 262.920 3 Template:Flatlist"," 35.48% 231.204 1 Template:Parser_functions_nav"," 34.78% 226.662 1 Template:Navbox"," 25.34% 165.163 208 Template:Translatable"," 23.15% 150.858 110 Template:Pagelang"," 17.00% 110.814 31 Template:Phpi"," 16.44% 107.160 31 Template:Inline-code"," 13.99% 91.177 1 Template:I18n_navigation"]},"scribunto":{"limitreport-timeusage":{"value":"0.166","limit":"10.000"},"limitreport-memusage":{"value":2415218,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-6df7948d6c-zmfbt","timestamp":"20241127204102","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10