Template:Yesno
Template page
More actions
English • čeština • Deutsch • español • français • italiano • 日本語 • 한국어 • polski • português • português do Brasil • русский • ไทย • Türkçe • українська • Tiếng Việt • 中文(简体) • 中文(繁體)
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
1Template: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,trueor1. no- Specifies the output of the template when the input value is a case-insensitive forms of
no,n,falseor0. 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,noor 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|anythingelse|def=spam}}-> "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:
- Create a subpage of this template with the language code of the language you want to translate to.
- 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.
- Translate the page according to the translation requirements of normal pages.
See also
Editors can experiment in this template's sandbox.