CINXE.COM
Multilingual Templates and Modules - 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-1 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>Multilingual Templates and Modules - 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-1 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":"d9bb8596-4d48-4ef9-942b-5cf62e0630c7","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Multilingual_Templates_and_Modules","wgTitle":"Multilingual Templates and Modules","wgCurRevisionId":6803184,"wgRevisionId":6803184,"wgArticleId":913297,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Templates"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Multilingual_Templates_and_Modules","wgRelevantArticleId":913297,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"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":20000,"wgInternalRedirectTargetUrl":"/wiki/Multilingual_Templates_and_Modules","wgTranslatePageTranslation":"source","wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgDiscussionToolsFeaturesEnabled":{"replytool":true,"newtopictool":true,"sourcemodetoolbar":true,"topicsubscription":false,"autotopicsub":false,"visualenhancements":false,"visualenhancements_reply":false,"visualenhancements_pageframe":false},"wgDiscussionToolsFallbackEditMode":"visual","wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q63090714","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.discussionTools.init.styles":"ready","oojs-ui-core.styles":"ready","oojs-ui.styles.indicators":"ready","mediawiki.widgets.styles":"ready","oojs-ui-core.icons":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"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=["mediawiki.action.view.redirect","ext.pygments.view","mediawiki.page.media","site","mediawiki.page.ready","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.discussionTools.init","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface","wikibase.client.vector-2022","ext.checkUser.clientHints","wikibase.sidebar.tracking"];</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&modules=ext.discussionTools.init.styles%7Cext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cmediawiki.widgets.styles%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui.styles.indicators%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <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 property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/c/c8/Synchronizer.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="1023"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/c/c8/Synchronizer.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="682"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Synchronizer.png/640px-Synchronizer.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="546"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Multilingual Templates and Modules - 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/Multilingual_Templates_and_Modules"> <link rel="alternate" type="application/x-wiki" title="Edit" href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit"> <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/Multilingual_Templates_and_Modules"> <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&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="ext-discussiontools-replytool-enabled ext-discussiontools-newtopictool-enabled ext-discussiontools-sourcemodetoolbar-enabled skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Multilingual_Templates_and_Modules rootpage-Multilingual_Templates_and_Modules 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:EntityPage/Q63090714#sitelinks-wikipedia" 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'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/?utm_source=donate&utm_medium=sidebar&utm_campaign=spontaneous&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&returnto=Multilingual+Templates+and+Modules" 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&returnto=Multilingual+Templates+and+Modules" 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/?utm_source=donate&utm_medium=sidebar&utm_campaign=spontaneous&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&returnto=Multilingual+Templates+and+Modules" 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&returnto=Multilingual+Templates+and+Modules" 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-Examples" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Examples"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Examples</span> </div> </a> <ul id="toc-Examples-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-General_method" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#General_method"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>General method</span> </div> </a> <ul id="toc-General_method-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Best_practices" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Best_practices"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Best practices</span> </div> </a> <button aria-controls="toc-Best_practices-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 Best practices subsection</span> </button> <ul id="toc-Best_practices-sublist" class="vector-toc-list"> <li id="toc-Naming" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Naming"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Naming</span> </div> </a> <ul id="toc-Naming-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Master_module" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Master_module"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Master module</span> </div> </a> <ul id="toc-Master_module-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Sandbox" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Sandbox"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>Sandbox</span> </div> </a> <ul id="toc-Sandbox-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Testcases" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Testcases"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>Testcases</span> </div> </a> <ul id="toc-Testcases-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Documentation" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Documentation"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.5</span> <span>Documentation</span> </div> </a> <ul id="toc-Documentation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Configuration" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Configuration"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.6</span> <span>Configuration</span> </div> </a> <ul id="toc-Configuration-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Synchronization" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Synchronization"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.7</span> <span>Synchronization</span> </div> </a> <ul id="toc-Synchronization-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Backwards_compatibility" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Backwards_compatibility"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.8</span> <span>Backwards compatibility</span> </div> </a> <ul id="toc-Backwards_compatibility-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Localization_of_template_parameters" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Localization_of_template_parameters"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.9</span> <span>Localization of template parameters</span> </div> </a> <ul id="toc-Localization_of_template_parameters-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Localization_of_user-readable_strings" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Localization_of_user-readable_strings"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10</span> <span>Localization of user-readable strings</span> </div> </a> <ul id="toc-Localization_of_user-readable_strings-sublist" class="vector-toc-list"> <li id="toc-Template_parameters" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Template_parameters"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10.1</span> <span>Template parameters</span> </div> </a> <ul id="toc-Template_parameters-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Config_file" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Config_file"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10.2</span> <span>Config file</span> </div> </a> <ul id="toc-Config_file-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Translation_tables" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Translation_tables"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10.3</span> <span>Translation tables</span> </div> </a> <ul id="toc-Translation_tables-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-MediaWiki_messages" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#MediaWiki_messages"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10.4</span> <span>MediaWiki messages</span> </div> </a> <ul id="toc-MediaWiki_messages-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-All_of_the_above" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#All_of_the_above"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10.5</span> <span>All of the above</span> </div> </a> <ul id="toc-All_of_the_above-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Template_data" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Template_data"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.11</span> <span>Template data</span> </div> </a> <ul id="toc-Template_data-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>See also</span> </div> </a> <ul id="toc-See_also-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-main">Multilingual Templates and Modules</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-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Multilingual_Templates_and_Modules" title="View the content page [c]" accesskey="c"><span>Page</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Multilingual_Templates_and_Modules" 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/Multilingual_Templates_and_Modules"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit" title="Edit the source code of this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Multilingual_Templates_and_Modules&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/Multilingual_Templates_and_Modules"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit" title="Edit the source code of this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Multilingual_Templates_and_Modules&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/Multilingual_Templates_and_Modules" 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/Multilingual_Templates_and_Modules" 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=Multilingual_Templates_and_Modules&oldid=6803184" 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=Multilingual_Templates_and_Modules&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&page=Multilingual_Templates_and_Modules&id=6803184&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&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FMultilingual_Templates_and_Modules"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FMultilingual_Templates_and_Modules"><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&bookcmd=book_creator&referer=Multilingual+Templates+and+Modules"><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&page=Multilingual_Templates_and_Modules&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=Multilingual_Templates_and_Modules&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" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q63090714" title="Link to connected data repository item [g]" accesskey="g"><span>Wikidata item</span></a></li> </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&group=page-Multilingual+Templates+and+Modules&action=page&filter=&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/Multilingual_Templates_and_Modules/id" class="mw-pt-progress mw-pt-progress--med" title="Templat dan Modul Berbagai Bahasa (20% translated)" lang="id" dir="ltr">Bahasa Indonesia</a></li> <li><a href="/wiki/Multilingual_Templates_and_Modules/de" class="mw-pt-progress mw-pt-progress--low" title="Mehrsprachige Vorlagen und Module (11% 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/Multilingual_Templates_and_Modules/fr" class="mw-pt-progress mw-pt-progress--complete" title="Modèles et modules multilingues (100% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Multilingual_Templates_and_Modules/pl" class="mw-pt-progress mw-pt-progress--low" title="Multilingual Templates and Modules/pl (6% translated)" lang="pl" dir="ltr">polski</a></li> <li><a href="/wiki/Multilingual_Templates_and_Modules/sv" class="mw-pt-progress mw-pt-progress--low" title="Flerspråkiga mallar och moduler (8% translated)" lang="sv" dir="ltr">svenska</a></li></ul></div> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Synchronizer.png" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Synchronizer.png/220px-Synchronizer.png" decoding="async" width="220" height="188" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Synchronizer.png/330px-Synchronizer.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Synchronizer.png/440px-Synchronizer.png 2x" data-file-width="734" data-file-height="626"/></a><figcaption>The <a href="/wiki/Special:MyLanguage/Synchronizer" title="Special:MyLanguage/Synchronizer">Synchronizer</a><span style="display:none"><a href="/wiki/Synchronizer" title="Synchronizer"> </a></span> tool is used to keep modules updated across wikis.</figcaption></figure> <p>This page explains how to create <b>global, cross-wiki and multilingual modules and templates</b>, and how to keep them synchronized across Wikimedia wikis. </p><p><b>Why is this needed?</b> Because we do not have a single Wikipedia, we have 300+ separate Wikipedias and other wiki projects, and every time someone creates a good new template or Lua module, it gets copied and translated 300+ times. Every translator has to thoroughly understand MediaWiki markup, making copying a very tedious and error-prone process, partially because template authors often assume their templates will be used in just one language. Once copied, the original templates are often improved, and each copy has to be updated while maintaining all existing translations. The pure human expense of copying templates and modules is so high that most of them are either never copied or never updated, especially for the smaller wikis. </p><p><b>Is this the best approach?</b> No, but it is the best approach with the current technology. A significant MediaWiki rewrite is required to make this possible on the system level. Multi-site templates has been requested from the start in 2001, but not much was done simply because this is a hard problem to solve. With this approach it is possible to create multilingual content now, and once MediaWiki supports it, we can easily migrate multilingual content to the new system without much work. </p> <meta property="mw:PageProp/toc"/> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Examples" data-mw-thread-id="h-Examples"><span data-mw-comment-start="" id="h-Examples"></span>Examples<span data-mw-comment-end="h-Examples"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=1" title="Edit section: Examples"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Examples","replies":[]}}--></div> <p>Here are some examples of Lua modules that have been globalized and are being kept in sync across wikis using the <a href="/wiki/Special:MyLanguage/Synchronizer" title="Special:MyLanguage/Synchronizer">Synchronizer</a><span style="display:none"><a href="/wiki/Synchronizer" title="Synchronizer"> </a></span> tool: </p> <ul><li><a href="/wiki/Module:Excerpt" title="Module:Excerpt">Module:Excerpt</a> (Q52428273-enwiki)</li> <li><a href="/wiki/Module:Transcluder" title="Module:Transcluder">Module:Transcluder</a> (Q96679044-enwiki)</li> <li><a href="/w/index.php?title=Module:Wd&action=edit&redlink=1" class="new" title="Module:Wd (page does not exist)">Module:Wd</a> (Q24733825-enwiki)</li> <li><a href="/wiki/Module:TNT" title="Module:TNT">Module:TNT</a> (Q28132212-mediawikiwiki)</li></ul> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="General_method" data-mw-thread-id="h-General_method"><span data-mw-comment-start="" id="h-General_method"></span>General method<span data-mw-comment-end="h-General_method"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=2" title="Edit section: General method"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-General_method","replies":[]}}--></div> <p>To make a global module: </p> <ol><li>Design or redesign the module so as to provide ways for wikis to localize everything they may need to localize, without having to modify the source code. This page describes several techniques to accomplish this.</li> <li>Use the <a href="/wiki/Special:MyLanguage/Synchronizer" title="Special:MyLanguage/Synchronizer">Synchronizer</a><span style="display:none"><a href="/wiki/Synchronizer" title="Synchronizer"> </a></span> tool to keep the source code identical across Wikimedia wikis.</li></ol> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Best_practices" data-mw-thread-id="h-Best_practices"><span data-mw-comment-start="" id="h-Best_practices"></span>Best practices<span data-mw-comment-end="h-Best_practices"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=3" title="Edit section: Best practices"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Best_practices","replies":["h-Naming-Best_practices","h-Master_module-Best_practices","h-Sandbox-Best_practices","h-Testcases-Best_practices","h-Documentation-Best_practices","h-Configuration-Best_practices","h-Synchronization-Best_practices","h-Backwards_compatibility-Best_practices","h-Localization_of_template_parameters-Best_practices","h-Localization_of_user-readable_strings-Best_practices","h-Template_data-Best_practices"]}}--></div> <p>This section describes some of the current best practices to develop global modules. </p> <div class="mw-heading mw-heading3"><h3 id="Naming" data-mw-thread-id="h-Naming-Best_practices"><span data-mw-comment-start="" id="h-Naming-Best_practices"></span>Naming<span data-mw-comment-end="h-Naming-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=4" title="Edit section: Naming"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>This section can be ignored for modules designed to be called from templates <b>only</b>. </p><p>Global modules that are meant to be used by other modules should be named the same in all wikis to avoid dependency breaks with other global modules. For example, if a module named A requires a module named B, but in some wiki, module B is named C, then module A will not work in that wiki, unless the source code of module A is changed locally to require C instead of B, which would defeat globalization (of module A). </p><p>If a local community does not accept the global name, or renaming is too much trouble, then a workaround is to create a "redirect module" with the global name, that simply requires and returns the module with the local name. </p><p>Fortunately, the fact that the Module <i>namespace</i> is named differently in each language doesn't break dependencies, because "Module" is an alias for the Module namespace in all languages. </p> <div class="mw-heading mw-heading3"><h3 id="Master_module" data-mw-thread-id="h-Master_module-Best_practices"><span data-mw-comment-start="" id="h-Master_module-Best_practices"></span>Master module<span data-mw-comment-end="h-Master_module-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=5" title="Edit section: Master module"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules should pick one wiki where to do the development. Generally this will be the home wiki of the module, but it may migrate for various reasons, for example to increase the chances of recruiting new developers by centralizing the development in a larger or more appropriate wiki. </p><p>Global modules should start with a comment that includes a link to the master module, to reduce the chances of forking and help recruit new developers (<a href="/wiki/Module:Excerpt#L-2" title="Module:Excerpt">example</a>). </p> <div class="mw-heading mw-heading3"><h3 id="Sandbox" data-mw-thread-id="h-Sandbox-Best_practices"><span data-mw-comment-start="" id="h-Sandbox-Best_practices"></span>Sandbox<span data-mw-comment-end="h-Sandbox-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=6" title="Edit section: Sandbox"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules should have a /sandbox subpage where to test out changes before deploying them to the master module and the other wikis (<a href="/wiki/Module:Transcluder/sandbox" title="Module:Transcluder/sandbox">example</a>). </p> <div class="mw-heading mw-heading3"><h3 id="Testcases" data-mw-thread-id="h-Testcases-Best_practices"><span data-mw-comment-start="" id="h-Testcases-Best_practices"></span>Testcases<span data-mw-comment-end="h-Testcases-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=7" title="Edit section: Testcases"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules should have a /testcases subpage with good unit tests to ensure high quality and stability of the module (<a href="/wiki/Module:Transcluder/testcases" title="Module:Transcluder/testcases">example</a>). Test cases should: </p> <ul><li>Use <a href="/wiki/Module:ScribuntoUnit" title="Module:ScribuntoUnit">Module:ScribuntoUnit</a></li> <li>Run with both the main module and the sandbox versions, so that we can compare the results (<a href="/wiki/Module:TableTools/testcases" title="Module:TableTools/testcases">example</a>)</li> <li>Use <a href="/wiki/Special:MyLanguage/Extension:Scribunto/Lua_reference_manual#strict" title="Special:MyLanguage/Extension:Scribunto/Lua reference manual">require('strict')</a><span style="display:none"><a href="/wiki/Extension:Scribunto/Lua_reference_manual#strict" title="Extension:Scribunto/Lua reference manual"> </a></span> to avoid accidentally using non-declared variables</li> <li>Output results both in <code>/testcases/doc</code> and the main <code>/doc</code> page of the module, to catch errors as early as possible</li></ul> <div class="mw-heading mw-heading3"><h3 id="Documentation" data-mw-thread-id="h-Documentation-Best_practices"><span data-mw-comment-start="" id="h-Documentation-Best_practices"></span>Documentation<span data-mw-comment-end="h-Documentation-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=8" title="Edit section: Documentation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules should have a /doc subpage with documentation of all public functions of the module (<a href="/wiki/Module:Transcluder/doc" title="Module:Transcluder/doc">example</a>) and a section with the testcase runs for both the primary and the sandbox versions of the module (<a href="/wiki/Module:TNT" title="Module:TNT">example</a>). </p> <div class="mw-heading mw-heading3"><h3 id="Configuration" data-mw-thread-id="h-Configuration-Best_practices"><span data-mw-comment-start="" id="h-Configuration-Best_practices"></span>Configuration<span data-mw-comment-end="h-Configuration-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=9" title="Edit section: Configuration"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules that require configuration should have a separate /config submodule to prevent local wikis from modifying the source code to configure the module (<a href="https://en.wikipedia.org/wiki/Module:Excerpt/config" class="extiw" title="en:Module:Excerpt/config">example</a>). </p> <div class="mw-heading mw-heading3"><h3 id="Synchronization" data-mw-thread-id="h-Synchronization-Best_practices"><span data-mw-comment-start="" id="h-Synchronization-Best_practices"></span>Synchronization<span data-mw-comment-end="h-Synchronization-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=10" title="Edit section: Synchronization"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Once a module is able to be copied unchanged to other wikis, the <a href="/wiki/Special:MyLanguage/Synchronizer" title="Special:MyLanguage/Synchronizer">Synchronizer</a><span style="display:none"><a href="/wiki/Synchronizer" title="Synchronizer"> </a></span> tool can be used to copy it and keep it synced across all Wikimedia wikis. </p> <div class="mw-heading mw-heading3"><h3 id="Backwards_compatibility" data-mw-thread-id="h-Backwards_compatibility-Best_practices"><span data-mw-comment-start="" id="h-Backwards_compatibility-Best_practices"></span>Backwards compatibility<span data-mw-comment-end="h-Backwards_compatibility-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=11" title="Edit section: Backwards compatibility"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules should generally keep development backwards-compatible, because changes that are not backwards-compatible will often require manual updates to each and every wiki, template and module that uses the module. </p> <div class="mw-heading mw-heading3"><h3 id="Localization_of_template_parameters" data-mw-thread-id="h-Localization_of_template_parameters-Best_practices"><span data-mw-comment-start="" id="h-Localization_of_template_parameters-Best_practices"></span>Localization of template parameters<span data-mw-comment-end="h-Localization_of_template_parameters-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=12" title="Edit section: Localization of template parameters"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Global modules can have their parameters localized by the template callers. For example, consider the following module that simply outputs the given text (or "Example" if none is given): </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">main</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kd">local</span> <span class="n">args</span> <span class="o">=</span> <span class="n">frame</span><span class="p">.</span><span class="n">args</span> <span class="kd">local</span> <span class="n">text</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="s1">'text'</span><span class="p">]</span> <span class="ow">or</span> <span class="s1">'Example'</span> <span class="kr">return</span> <span class="n">text</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>Then a Spanish template would localize the module like so: </p> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr" dir="ltr"><pre><span></span>{{#invoke:Example|main | text = <span class="nb">{{{</span><span class="cp">texto|Ejemplo</span><span class="nb">}}}</span> }} </pre></div> <p>Notice that the template not only localizes the name of the "text" parameter ("texto" means "text" in Spanish), but also the default text ("Ejemplo" means "Example" in Spanish). </p><p>See <a href="https://es.wikipedia.org/wiki/Plantilla:Extracto" class="extiw" title="es:Plantilla:Extracto">Plantilla:Extracto</a> for a real case of a template that localizes a global module with this technique. Also, see <a href="https://en.wikipedia.org/wiki/Template:Excerpt" class="extiw" title="w:Template:Excerpt">Template:Excerpt</a> for a case where a global module is localized to the English Wikipedia, demonstrating that localization is not always the same as translation. </p> <div class="mw-heading mw-heading3"><h3 id="Localization_of_user-readable_strings" data-mw-thread-id="h-Localization_of_user-readable_strings-Best_practices"><span data-mw-comment-start="" id="h-Localization_of_user-readable_strings-Best_practices"></span>Localization of user-readable strings<span data-mw-comment-end="h-Localization_of_user-readable_strings-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=13" title="Edit section: Localization of user-readable strings"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Many modules need to output user-readable strings, such as error messages and interface elements (like buttons). Hard-coding the text of these strings forces other wikis to modify the code in order to localize them, preventing globalization. To avoid this, developers should provide ways to localize user-readable strings without having to modify the code itself. This section explains several ways to accomplish this. </p> <div class="mw-heading mw-heading4"><h4 id="Template_parameters" data-mw-thread-id="h-Template_parameters-Localization_of_user-readable_strings"><span data-mw-comment-start="" id="h-Template_parameters-Localization_of_user-readable_strings"></span>Template parameters<span data-mw-comment-end="h-Template_parameters-Localization_of_user-readable_strings"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=14" title="Edit section: Template parameters"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>User-readable strings can be localized through template parameters when calling the module. This approach is convenient when: </p> <ul><li>The text is likely to vary with each template call</li> <li>The text is likely to be changed by users when calling the template</li> <li>The text is likely to contain a <a href="/wiki/Special:MyLanguage/Help:Magic_words" title="Special:MyLanguage/Help:Magic words">magic word</a>, a template call, a parser function or some other wiki element</li></ul> <p>An example of a module using this approach would be: </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">main</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kd">local</span> <span class="n">args</span> <span class="o">=</span> <span class="n">frame</span><span class="p">.</span><span class="n">args</span> <span class="kd">local</span> <span class="n">text</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="s1">'text'</span><span class="p">]</span> <span class="ow">or</span> <span class="s1">'Example'</span> <span class="kr">return</span> <span class="n">text</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>This way, every template may modify the text when calling the module, like so: </p> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr" dir="ltr"><pre><span></span>{{#invoke:Example|main | text = Ejemplo }} </pre></div> <p>Notice that in this example, if a template calls the module without specifying the <code>text</code> parameter, then the hard-coded English text 'Example' would be used. This is not necessary. Modules may require template callers to set the <code>text</code> parameter by throwing an error if they don't. However, it's often friendlier to have a fallback. </p> <div class="mw-heading mw-heading4"><h4 id="Config_file" data-mw-thread-id="h-Config_file-Localization_of_user-readable_strings"><span data-mw-comment-start="" id="h-Config_file-Localization_of_user-readable_strings"></span>Config file<span data-mw-comment-end="h-Config_file-Localization_of_user-readable_strings"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=15" title="Edit section: Config file"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Another way to localize user-readable strings is through a separate /config subpage. This approach is convenient when: </p> <ul><li>The module is meant to be called by many templates per wiki, thus allowing localization to be done only once and then reused</li> <li>There're many messages to localize, so it's easier to have them all together in their own place</li> <li>There's already a need for a /config file for other reasons, so we might as well use it for localization too</li></ul> <p>An example of a module using this approach would be: </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">config</span> <span class="o">=</span> <span class="nb">require</span><span class="p">(</span><span class="s1">'Module:Example/config'</span><span class="p">)</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">main</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kd">local</span> <span class="n">text</span> <span class="o">=</span> <span class="n">config</span><span class="p">.</span><span class="n">text</span> <span class="ow">or</span> <span class="s1">'Example'</span> <span class="kr">return</span> <span class="n">text</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>Then wikis would be able to create /config files like the following: </p> <div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">return</span> <span class="p">{</span> <span class="n">text</span> <span class="o">=</span> <span class="s1">'Ejemplo'</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Translation_tables" data-mw-thread-id="h-Translation_tables-Localization_of_user-readable_strings"><span data-mw-comment-start="" id="h-Translation_tables-Localization_of_user-readable_strings"></span>Translation tables<span data-mw-comment-end="h-Translation_tables-Localization_of_user-readable_strings"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=16" title="Edit section: Translation tables"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Another way to localize user-readable strings is through a central <a href="/wiki/Special:MyLanguage/Help:Tabular_Data" title="Special:MyLanguage/Help:Tabular Data">translation table</a><span style="display:none"><a href="/wiki/Help:Tabular_Data" class="mw-redirect" title="Help:Tabular Data"> </a></span> at Commons. This approach is convenient when: </p> <ul><li>The strings should vary with the preferred language of the user, rather than the language of the wiki or page.</li> <li>We want to centralize localization efforts on a single page.</li></ul> <p>The <a href="/wiki/Module:TNT" title="Module:TNT">Module:TNT</a> was created specifically to get strings from translation tables. An example module using TNT could look like this: </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">TNT</span> <span class="o">=</span> <span class="nb">require</span><span class="p">(</span><span class="s1">'Module:TNT'</span><span class="p">)</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">main</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kd">local</span> <span class="n">text</span> <span class="o">=</span> <span class="n">TNT</span><span class="p">.</span><span class="n">format</span><span class="p">(</span><span class="s1">'I18n/Example'</span><span class="p">,</span> <span class="s1">'text'</span><span class="p">)</span> <span class="kr">return</span> <span class="n">text</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>See <a href="https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab" class="extiw" title="commons:Data:I18n/Template:Graphs.tab">Data:I18n/Template:Graphs.tab</a> for a simple but real example of a translation table with two messages, each having a single parameter. It's important to store parameters as parts of the strings because in many languages the parameter would have to be placed at a different position in the string according to the norms of the language. </p><p>Translation tables should start with the "Data:I18n/..." prefix to separate them from other types of tabular data. If a message has not yet been localized, TNT will fall back to English (or other fallback language as defined by the language's <a href="/wiki/Special:MyLanguage/Manual:Language#Fallback_languages" title="Special:MyLanguage/Manual:Language">fallback sequence</a><span style="display:none"><a href="/wiki/Manual:Language#Fallback_languages" title="Manual:Language"> </a></span>). TNT also supports all standard localization conventions such as {{PLURAL|...}} and <a href="/wiki/Special:MyLanguage/Manual:Messages_API" title="Special:MyLanguage/Manual:Messages API">other parameters</a><span style="display:none"><a href="/wiki/Manual:Messages_API" title="Manual:Messages API"> </a></span>. </p><p>One downside of this approach is that it requires installing and setting up <a href="/wiki/Special:MyLanguage/Extension:JsonConfig" title="Special:MyLanguage/Extension:JsonConfig">Extension:JsonConfig</a><span style="display:none"><a href="/wiki/Extension:JsonConfig" title="Extension:JsonConfig"> </a></span>, which may not have been done on non-Wikimedia wikis, limiting the ability to reuse these modules on third-party wikis. </p> <div class="mw-heading mw-heading4"><h4 id="MediaWiki_messages" data-mw-thread-id="h-MediaWiki_messages-Localization_of_user-readable_strings"><span data-mw-comment-start="" id="h-MediaWiki_messages-Localization_of_user-readable_strings"></span>MediaWiki messages<span data-mw-comment-end="h-MediaWiki_messages-Localization_of_user-readable_strings"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=17" title="Edit section: MediaWiki messages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In some cases, MediaWiki itself (or some extension) may have the messages we need already localized. For example, if we need the string "New page" we may use <a href="/wiki/MediaWiki:Newpage" title="MediaWiki:Newpage">MediaWiki:Newpage</a>, like so: </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">main</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span> <span class="kd">local</span> <span class="n">msg</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">'newpage'</span><span class="p">)</span> <span class="kd">local</span> <span class="n">text</span> <span class="o">=</span> <span class="n">msg</span><span class="p">:</span><span class="n">plain</span><span class="p">()</span> <span class="kr">return</span> <span class="n">text</span> <span class="kr">end</span> <span class="kr">return</span> <span class="n">p</span> </pre></div> <p>See <a href="/wiki/Special:AllMessages" title="Special:AllMessages">Special:AllMessages</a> for a list of all available messages. </p> <div class="mw-heading mw-heading4"><h4 id="All_of_the_above" data-mw-thread-id="h-All_of_the_above-Localization_of_user-readable_strings"><span data-mw-comment-start="" id="h-All_of_the_above-Localization_of_user-readable_strings"></span>All of the above<span data-mw-comment-end="h-All_of_the_above-Localization_of_user-readable_strings"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=18" title="Edit section: All of the above"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Depending on the case, all of the above methods may be combined. For example, MediaWiki messages may be used when available, and when not, a translation table or config file is queried, and if no localization is found there, then a hard-coded English text is used, unless a template parameter overrides it. </p><p>Combining several methods can be effective, but the benefits should be weighted against the downsides of the increased complexity, which may cause performance loss and bugs, as well as more difficulty in maintaining the code and recruiting new developers. </p> <div class="mw-heading mw-heading3"><h3 id="Template_data" data-mw-thread-id="h-Template_data-Best_practices"><span data-mw-comment-start="" id="h-Template_data-Best_practices"></span>Template data<span data-mw-comment-end="h-Template_data-Best_practices"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=19" title="Edit section: Template data"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Template parameters are usually stored as a <a href="https://en.wikipedia.org/wiki/JSON" class="extiw" title="wikipedia:JSON">JSON</a> <a href="/wiki/Special:MyLanguage/Help:TemplateData" title="Special:MyLanguage/Help:TemplateData">templatedata</a> block inside the template's <code>/doc</code> subpage. This makes it convenient to translate, but when a new parameter is added to a global template, all <code>/doc</code> pages need to be updated in every language. <a href="/wiki/Module:TNT" title="Module:TNT">Module:TNT</a> helps with this by automatically generating the templatedata block from a table stored on Commons. Placing the following line into every <code>/doc</code> subpage will use <a href="https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab" class="extiw" title="commons:Data:Templatedata/Graph:Lines.tab">Data:Templatedata/Graph:Lines.tab</a> table to generate all the needed templatedata information in every language. Even if the local community has not translated the full template documentation, they will be able to see all template parameters, centrally updated. </p> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr" dir="ltr"><pre><span></span>{{#invoke:TNT|doc|Graph:Lines}} </pre></div> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="See_also" data-mw-thread-id="h-See_also"><span data-mw-comment-start="" id="h-See_also"></span>See also<span data-mw-comment-end="h-See_also"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Multilingual_Templates_and_Modules&action=edit&section=20" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-See_also","replies":[]}}--></div> <ul><li><a href="https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2019/Miscellaneous/Shared_Multilingual_Templates_and_Modules_available_to_all_wikis" class="extiw" title="meta:Community Wishlist Survey 2019/Miscellaneous/Shared Multilingual Templates and Modules available to all wikis">Wishlist proposal 2019</a> (40 votes)</li> <li><a href="https://phabricator.wikimedia.org/T122086" class="extiw" title="phab:T122086">T122086</a> - RFC: Sharing templates and modules between wikis - poor man's version (original idea for this bot)</li> <li><a href="https://phabricator.wikimedia.org/T121470" class="extiw" title="phab:T121470">T121470</a> - Central Global Repository for Templates, Lua modules, and Gadgets ticket (main ticket for everything cross-site shareable)</li> <li><a href="https://phabricator.wikimedia.org/T41610" class="extiw" title="phab:T41610">T41610</a> - Scribunto should support global module invocations</li> <li><a href="/wiki/Special:MyLanguage/Global_templates/Proposed_specification,_short_version" title="Special:MyLanguage/Global templates/Proposed specification, short version">Global templates/Proposed specification, short version</a> - Proposal to implement a similar idea comprehensively, without the need for the special tools, and with full support in MediaWiki core and extensions</li> <li><a href="/wiki/Special:MyLanguage/Global_gadgets" title="Special:MyLanguage/Global gadgets">Global gadgets</a><span style="display:none"><a href="/wiki/Global_gadgets" title="Global gadgets"> </a></span> - Gadgets that are designed and ready to be used in any wiki</li></ul> <!-- NewPP limit report Parsed by mw‐api‐int.codfw.main‐849f99967d‐c8q7l Cached time: 20241123235301 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] DiscussionTools time usage: 0.019 seconds CPU time usage: 0.259 seconds Real time usage: 0.316 seconds Preprocessor visited node count: 995/1000000 Post‐expand include size: 5228/2097152 bytes Template argument size: 2260/2097152 bytes Highest expansion depth: 13/100 Expensive parser function count: 16/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 7633/5000000 bytes Lua time usage: 0.024/10.000 seconds Lua memory usage: 1075240/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 100.212 1 -total 94.19% 94.385 10 Template:Ll 47.12% 47.220 20 Template:Translatable 37.24% 37.316 10 Template:Pagelang 16.62% 16.660 5 Template:TNTN 5.62% 5.627 4 Translations:Synchronizer/Page_display_title/en 3.49% 3.500 1 Translations:Extension:JsonConfig/Page_display_title/en --> <!-- Saved in parser cache with key mediawikiwiki:pcache:idhash:913297-0!canonical and timestamp 20241123235301 and revision id 6803184. Rendering was triggered because: api-parse --> </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=Multilingual_Templates_and_Modules&oldid=6803184">https://www.mediawiki.org/w/index.php?title=Multilingual_Templates_and_Modules&oldid=6803184</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">Category</a>: <ul><li><a href="/wiki/Category:Templates" title="Category:Templates">Templates</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 19 October 2024, at 11:19.</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=Multilingual_Templates_and_Modules&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-f69cdc8f6-nt2gf","wgBackendResponseTime":157,"wgDiscussionToolsPageThreads":[{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Examples","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-General_method","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Best_practices","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Naming-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Master_module-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Sandbox-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Testcases-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Documentation-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Configuration-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Synchronization-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Backwards_compatibility-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Localization_of_template_parameters-Best_practices","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Localization_of_user-readable_strings-Best_practices","replies":[{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Template_parameters-Localization_of_user-readable_strings","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Config_file-Localization_of_user-readable_strings","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Translation_tables-Localization_of_user-readable_strings","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-MediaWiki_messages-Localization_of_user-readable_strings","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-All_of_the_above-Localization_of_user-readable_strings","replies":[]}]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Template_data-Best_practices","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-See_also","replies":[]}],"wgPageParseReport":{"discussiontools":{"limitreport-timeusage":"0.019"},"limitreport":{"cputime":"0.259","walltime":"0.316","ppvisitednodes":{"value":995,"limit":1000000},"postexpandincludesize":{"value":5228,"limit":2097152},"templateargumentsize":{"value":2260,"limit":2097152},"expansiondepth":{"value":13,"limit":100},"expensivefunctioncount":{"value":16,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":7633,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 100.212 1 -total"," 94.19% 94.385 10 Template:Ll"," 47.12% 47.220 20 Template:Translatable"," 37.24% 37.316 10 Template:Pagelang"," 16.62% 16.660 5 Template:TNTN"," 5.62% 5.627 4 Translations:Synchronizer/Page_display_title/en"," 3.49% 3.500 1 Translations:Extension:JsonConfig/Page_display_title/en"]},"scribunto":{"limitreport-timeusage":{"value":"0.024","limit":"10.000"},"limitreport-memusage":{"value":1075240,"limit":52428800}},"cachereport":{"origin":"mw-api-int.codfw.main-849f99967d-c8q7l","timestamp":"20241123235301","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Multilingual Templates and Modules","url":"https:\/\/www.mediawiki.org\/wiki\/Multilingual_Templates_and_Modules","sameAs":"http:\/\/www.wikidata.org\/entity\/Q63090714","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q63090714","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2019-04-11T21:13:09Z","dateModified":"2024-10-19T11:19:39Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/c\/c8\/Synchronizer.png","headline":"This template or module exists on more than one wiki site, and will be kept identical on all sites with DiBabel tool. See \"mw:WP:TNT\"."}</script> </body> </html>