Toggle menu
3
389
1
853
Seul En Groupe
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Protection

File:Notebook.pngDocumentation

This is a metatemplate used to normalize the input to a boolean value.

Usage

{{Yesno|<input>}} This will return as yes or blank (no) based on the input. The output can be customized with parameters.

Parameters

1 Template:Sup
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.
¬
Specifies the output of the template when the input value is missing.

Logic distinction

Output parameter Default output Matches Inputs
yes yes yes, y, true, t, on, 1 yes, y, true, t, on, 1
no (null) no, n, false, f, off, 0 no, n, false, f, off, 0
blank no blank input (empty string)
def yes any other value (any other value)
¬ blank handled as ¬ (param 1 missing)

Examples

Basic usage

Custom output

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

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.