Template:Yesno

From PZwiki
Lock-locked.png
This page has been put into protection by a PZwiki administrator.
Only users in the sysop user group may edit this page.
Notebook.pngTemplate Documentation

This template normalizes the input to a boolean value.

Usage

Parameters

1 Required
The value to be evaluated.
yes
Specifies the output of the template when the input value is a case-insensitive forms of yes, y, true or 1.
no
Specifies the output of the template when the input value is a case-insensitive forms of no, n, false or 0.
blank
Specifies the output of the template when the input value is defined but is either empty or contains nothing but whitespace character(s).
def
Specifies the output of the template when the input value is defined but not a form of yes, no or blank.

Examples

Basic usage

Custom output

  • {{Yesno|yes|yes=bacon}} -> "bacon"
  • {{Yesno|no|no=ham}} -> "ham"
  • {{Yesno|blank=eggs}} -> "eggs"
    • {{Yesno|no=ham}} -> "ham"
    • {{Yesno|blank=eggs|no=ham}} -> "eggs"
  • {{Yesno|anythingelse|def=spam}} -> "spam"
    • {{Yesno|anythingelse|yes=bacon}} -> "bacon"
    • {{Yesno|anythingelse|def=spam|yes=bacon}} -> "spam"

How to translate

This template doesn't need to/shouldn't be translated, but you can translate the documentation of this template with the following steps:

  1. Create a subpage of this template with the language code of the language you want to translate to.
  2. Copy the code wrapped in the <noinclude> tag in this template into the page you created.
    {{Translation guide}} template should be removed from the translated documentation.
  3. Translate the page according to the translation requirements of normal pages.

See also

Editors can experiment in this template's sandbox.