Template:IfNotTranslation: Difference between revisions

From Bonkipedia
[[mw:]]>Shirayuki
m (Undo revision 5047261 by Kaganer (talk): use Template:pagelang; per Topic:Wph71uhl7sx8q83n)
 
m (1 revision imported: Workaround and Utility Templates)
 
(No difference)

Latest revision as of 17:52, 12 November 2022

Template documentation

This template conditionally activate the first parameter if the current page is the source document (hence not a translation), or the second if the current page is a translation subpage.

Usage

{{ifNotTranslation|1|2}}

Parameters:

  1. any wikitext in the second parameter is used if the page is not a translation (source document)
  2. any wikitext in the first parameter is used if the page is a translation (any translation: "/en", "/zh", etc.)
Important note: this template is not exactly the opposite of {{ifTranslation}}. This present template do consider the "/en" subpage as a translation (it is triggered by the second parameter), but {{ifTranslation}} doesn’t considers the "/en" subpage as a translation (triggered by its second parameter).

Important use case: To conditionally include a category only in the source document, this present template is preferred (else the category would also contain the "/en" subpage).

Warning: This template is intended to be used with the pages translated with the Translate extension. For translations which are not using Translate, its behavious could be misleading – e.g. if used on m:Pobočky Wikimedia (unsynchronised Czech translation of m:Wikimedia chapters) the template will behave as if it was a page in English (not a translation), and if used on a page ending with "/en" it will behave as if it was a source document even if the page is a translation into English from another language.

Example

If the code {{ifNotTranslation|Category:Wikipedia Zero}} is at the end of the page m:Wikipedia Zero Starting Page, then m:Wikipedia Zero Starting Page will be included in the category Wikipedia Zero, but nor m:Wikipedia Zero Starting Page/fr nor m:Wikipedia Zero Starting Page/en will be in the category.

See also