Jump to content

Template:Engvar/doc

From Simple English Wikipedia, the free encyclopedia

This template is used inside other templates. It allows templates to show national varieties of English, when |engvar= is passed by each article.

For example, one template can display "football" for |engvar=en-UK articles, and "soccer" for |engvar=en-US articles.

  1. Articles specify the English variety parameter for relevant templates like {{example|engvar=en-US}}. They do not use {{engvar}}.
  2. Templates use {{engvar}}. It should not forget to pass-through |engvar={{{engvar|}}}
...
| label3 = {{engvar |defaultWord=Colour |defaultLang=en-UK |en-US=Color |engvar={{{engvar|auto}}} }}
|  data3 = {{{color|}}}
| label4 = {{engvar |defaultWord=Football |defaultLang=en-UK |en-US=Soccer |engvar={{{engvar|auto}}} }} team
|  data4 = {{{team|}}}
...

The |defaultWord= be shown by default. But if an article asks for an English variety that has a corresponding parameter specified in the template, the value will be shown.

In the example, the template specified a British English word as default whenever no |engvar= is specified by the article. The word can be changed in an American English article by that article specifying |engvar=en-US. The fallback 'auto' value means it will try to determine the language based on templates like {{Use British English}} or {{Use American English}} being present on the page if no engvar is specified.

Note: {{engvar}} is unrelated to parameter names like |color= vs. |colour=. See programming option |data3={{{color|{{{colour|}}} }}}