Template:Engvar/doc

From Wikipedia, the free encyclopedia

Page Module:Message box/ombox.css has no content.

Script error: No such module "High-use".

Page Module:Message box/ombox.css has no content.

This template is used inside other templates. <section begin="ledeMinusLeadSentence" />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.<section end="ledeMinusLeadSentence" />

Usage

  1. Articles specify the English variety parameter for relevant templates like Template:Tlc. They do not use Template:Tlc.
  2. Templates use Template:Tlc. 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 Template:Tl or Template:Tl being present on the page if no engvar is specified.

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

Example

Consider an example template, a fictive Template:Tlf. The demo is encoded in {{Engvar/doc/infobox demo}}.

Template code

<strong class="error"><span class="scribunto-error mw-scribunto-error-aae1097f">Script error: No such module &quot;DecodeEncode&quot;.</span></strong>

Three articles

Page Module:Infobox/styles.css has no content.

Personal likes
Demo: using WP:Engvar in templates
Home countryWales
Lua error in package.lua at line 80: module 'Module:Engvar/detect' not found. things
Lua error in package.lua at line 80: module 'Module:Engvar/detect' not found.Blue
Lua error in package.lua at line 80: module 'Module:Engvar/detect' not found. teamFC Kuusysi
In this demo 'article', the template parameter is set: |engvar=(unspecified)
{{Engvar/doc/infobox demo
| home country = Wales
| color = Blue
| team  = [[FC Kuusysi]]
<!-- |engvar= not set; expect defaults -->
}}

Page Module:Infobox/styles.css has no content.

Personal likes
Demo: using WP:Engvar in templates
Home countryAlaska
Favorite things
ColorBlue
Soccer teamFC Kuusysi
In this demo 'article', the template parameter is set: |engvar=en-US
{{Engvar/doc/infobox demo
| home country = Alaska
| color = Blue
| team  = [[FC Kuusysi]]
| engvar= en-US
}}

Page Module:Infobox/styles.css has no content.

Personal likes
Demo: using WP:Engvar in templates
Home countryAustralia
Favourite things
ColourBlue
Association Football teamFC Kuusysi
In this demo 'article', the template parameter is set: |engvar=Australian
{{Engvar/doc/infobox demo
| home country = Australia
| color = Blue
| team  = [[FC Kuusysi]]
| engvar= Australian
}}

A live example

Currently, Template:Tl has five Template:Tlf words. Phosphorus shows |engvar=en-UK despite the |engvar=en-US default.

Parameter list

Template

{{engvar
<strong class="error"><span class="scribunto-error mw-scribunto-error-aae1097f">Script error: No such module &quot;DecodeEncode&quot;.</span></strong>

Article

{{example
| engvar =
| engvarCat =
}}

List of English varieties

In the template, use the exact ISO-code as the parameter name like |en-GB=vapour. Write |en-US=soccer not |American English=soccer. Needed varieties have articles using the template and words differing from the default.

English variety ISO-code
American English Template:Pval
Australian English Template:Pval
British English Template:Pval
Canadian English Template:Pval
Hiberno-English (Irish English) Template:Pval
Hong Kong English Template:Pval
Indian English Template:Pval
Jamaican English Template:Pval
Malawian English Template:Pval
New Zealand English Template:Pval
Nigerian English Template:Pval
Pakistani English Template:Pval
Philippine English Template:Pval
Scottish English Template:Pval
Singapore English Template:Pval
South African English Template:Pval
Trinidadian English Template:Pval
British English Oxford spelling
British (Oxford) English
Oxford English Dictionary (OED)
Template:Pval
IUPAC spelling Template:Pval

There is backwards compatibility for leeway in articles. |engvar=en-US, |engvar=United States, |engvar=US can all show the |en-US=football variety.

Maintenance category

Articles with an invalid |engvar= will be placed in the hidden maintenance category Category:Articles using an unknown Template:Engvar option. Articles listed may need editing.

An article's requested |engvar= may be unspecified in the template. For example, if an article uses Template:Tlc but the template has no |en-ZA=, then the template will return |defaultWord=default color name. The category will not be used.

When this categorization is not desired for a whole template, set |engvarCat=no in the template
Otherwise pass-through this setting from the article: |engvarCat={{{engvarCat|yes}}}. This allows the editor to switch categorization off per article.

Articles are sorted by |engvarCatSort= or {{pagenameScript error: No such module "params".}} by default. Note that other templates will fill this category. Set this parameter like |engvarCatSort=Personal prefs in a template to group its listings under "P".

Template data

Template:Template data header

No description.

Template parameters

ParameterDescriptionTypeStatus
Default spellingdefaultword

The default word, usually the word in the English variety most often used

Example
colour
Stringsuggested
Default English varietydefaultLang

Adding this helps document your {{engvar}} setting

Suggested values
en-US en-AU en-GB en-CA en-EI en-HK en-IN en-JM en-MW en-NZ en-NG en-PK en-PH en-SCO en-SG en-ZA en-TT en-OED en-IUPAC
Example
en-US
Stringsuggested
English varietyengvar

English variety to use. Set to 'auto' to try to detect variety based on templates such as {{Use British English}} or {{EngvarB}} being present on the page.

Suggested values
{{{engvar|auto}}} {{{engvar|}}} auto
Stringrequired
Suppress maintenance categoryengvarCat

no description

Suggested values
{{{engvarCat|yes}}} no
Default
yes
Stringsuggested
Fallbackfallback

Whether Commonwealth English languages should fallback to en-GB if not specified

Default
false unless engvar=auto
Booleanoptional
Maintenance category sort keyengvarCatSort

no description

Default
{{pagename}}
Stringoptional
American English spellingen-US

no description

Example
color
Stringoptional
Australian English spellingen-AU

no description

Stringoptional
British English spellingen-GB

no description

Stringoptional
Canadian English spellingen-CA

no description

Stringoptional
Hiberno-English (Irish-English) spellingen-EI

no description

Stringoptional
Hong Kong English spellingen-HK

no description

Stringoptional
Indian English spellingen-IN

no description

Stringoptional
Jamaican English spellingen-JM

no description

Stringoptional
Malawian English spellingen-MW

no description

Stringoptional
New Zealand English spellingen-NZ

no description

Stringoptional
Nigerian English spellingen-NG

no description

Stringoptional
Pakistani English spellingen-PK

no description

Stringoptional
Philippine English spellingen-PH

no description

Stringoptional
Scottish English spellingen-SCO

no description

Stringoptional
Singapore English spellingen-SG

no description

Stringoptional
South African English spellingen-ZA

no description

Stringoptional
Trinidadian English spellingen-TT

no description

Stringoptional
British (Oxford) English spellingen-OED

no description

Stringoptional
IUPAC spellingen-IUPAC

no description

Stringoptional

See also