Jump to content

Template:Msg-meta/doc

From translatewiki.net
This is the documentation subpage for the parent Template:Msg-meta page.

This is a meta template for {{Msg}} template families. Uses Module:Msg to do most of things.

Syntax

{{Msg-meta
| meta = <!-- suffix of the "Msg-*" template page name -->
| namespace = <!-- namespace name for target messages -->
| 1 = {{{1<noinclude>|Example message ID</noinclude>}}}
| 2 = {{{2|}}}
| notext = {{{notext|}}}
| exist = {{{exist|}}}
| lang = {{{lang|}}}
}}

Parameters

  • |meta= last part of the template name appended after "Template:Mw-".
  • |namespace= namespace which the msg template targets.
  • |1= (pass through) message ID (should exist inside the indicated namespace, required parameter).
  • |2= (pass through) optional comment.
  • |notext= (pass through) whether or not to show the localised message text. Any non-empty value will drop this display (after the message id and the optional comment). Should be empty by default.
  • |exist= (pass through) whether or not to test the existence for the message (and track it in a subcategory of Category:Message maintenance). Should be empty by default to enable this maintenance, however some message documentation subpages populated with lot of messages may no longer work. If this parameter is explicitly set to a non-empty value, no check of existence will be made (assuming that the message really exists), and this can be used (on common messages such as those of Mediawiki Core) to reduce the number of "costly parser function calls" (to code>#ifexist:: it is limited to 100 tests per viewed page) in order to preserve the check for messages listed at end of a list of messages.
  • |lang= (pass through) specifies the language of the translated message to display, instead of {{RelevantLanguage}} by default.

Examples

  • {{Msg-libreviews|find us on|contains HTML markup}} for linking a sample message is first expanded into: {{Msg-meta|meta=libreviews|class=msg-libreviews|namespace=lib.reviews|find us on|contains HTML markup}},
    which gives: find us on [contains HTML markup] ("You can also find us <a href='https://github.com/eloquence/lib.reviews'>on GitHub</a> and chat with us on IRC (<b>#lib.reviews</b> on <a href='https://libera.chat/'>libera.chat</a>).<p>Watch a <a href='/static/uploads/screencast3.webm'>short screencast</a> (<a href='https://www.youtube.com/watch?v=vHX33WbLrVE&feature=youtu.be'>YouTube version</a>) about the state of things as of October 2017.").
    Note that the source text of messages displayed by default (unless the |notext=* parameter is passed with a non-empty value) are rendered into their unparsed and unexpanded source form, so the HTML and MediaWiki markups are visible, along with trailing spaces that are sometimes needed and internally HTML-encoded to avoid them being discarded in saved messages, and leading characters with special meaning in MediaWiki are not reinterpreted (this is useful for messages not intended to be rendered in MediaWiki, or whose normal parsing may break the layout or generate incorrect links when we just want to cite the message by reference).
    As well, line wraps can occur at arbitrary position, independantly of the actual language used (useful for a few very technical messages with specific formats that can't fit the width allowed, e.g. for citing related messages in the lateral panel of TranslateUI). However, linebreaks that are present in the message source will be treated as whitespace, and embedded HTML comments are discarded and not displayed.
    If you want to display how the message will be parsed and rendered by MediaWiki, don't use this template, just transclude the message itself (use its full name with its leading namespace, and followed by a slash and the language code).
  • You can render the same message with its source in English (instead of the user language or the relevant language for the page where it is displayed).
    So: {{Msg-libreviews|find us on|contains HTML markup|lang=en}} is first expanded into: {{Msg-meta|meta=libreviews|class=msg-libreviews|namespace=lib.reviews|lang=en|find us on|contains HTML markup}},
    which gives: find us on [contains HTML markup] ("You can also find us <a href='https://github.com/eloquence/lib.reviews'>on GitHub</a> and chat with us on IRC (<b>#lib.reviews</b> on <a href='https://libera.chat/'>libera.chat</a>).<p>Watch a <a href='/static/uploads/screencast3.webm'>short screencast</a> (<a href='https://www.youtube.com/watch?v=vHX33WbLrVE&feature=youtu.be'>YouTube version</a>) about the state of things as of October 2017.").
  • {{Msg-fudforum}} uses:
    {{Msg-meta
    | meta = fudforum
    | namespace = FUDforum
    | 1 = {{{1<noinclude>|Locked</noinclude>}}}
    | 2 = {{{2|}}}
    | notext = {{{notext|}}}
    | exist = {{{exist|}}}
    | lang = {{{lang|}}}
    }}
    


See also