Module:Engvar/doc
This is the documentation page for Module:Engvar
| This is a documentation subpage for Module:Engvar. It may contain usage information, categories and other content that is not part of the original module page. |
| This Lua module is used on approximately 16,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
| This module depends on the following other modules: |
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.
Usage
[dezie ebe o si]- Articles specify the English variety parameter for relevant templates like
{{example|engvar=en-US}}. They do not use{{engvar}}. - 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|}}} }}}
Example
[dezie ebe o si]Consider an example template, a fictive {{infobox personal likes}}. The demo is encoded in {{Engvar/doc/infobox demo}}.
Template code
[dezie ebe o si]{{infobox
| title = Personal likes
| above = Demo: using [[WP:ENGVAR|WP:Engvar]] in templates
| abovestyle = background:#ddd; font-weight:normal; font-size:smaller;
| headerstyle = background:lemonchiffon
| label1 = Home country
| data1 = {{{home country|}}}
| header2 = {{engvar|defaultWord=Favourite |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Favorite }} things
| label3 = {{engvar|defaultWord=Colour |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Color }}
| data3 = {{{color|}}}
| label4 = {{engvar|defaultWord=Football |defaultLang=en-GB | engvar={{{engvar|auto}}}
|en-US=Soccer |en-AU=Association Football}} team
| data4 = {{{team|}}}
| below = In this demo 'article', the template parameter is set: {{para|1=engvar|2={{{engvar|(unspecified)}}}}}
| belowstyle = background:#ddd;
}}
Three articles
[dezie ebe o si]| Demo: using WP:Engvar in templates | |
|---|---|
| Home country | Wales |
| Favourite things | |
| Colour | Blue |
| Football team | FC 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 -->
}}
| Demo: using WP:Engvar in templates | |
|---|---|
| Home country | Alaska |
| Favorite things | |
| Color | Blue |
| Soccer team | FC 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
}}
| Demo: using WP:Engvar in templates | |
|---|---|
| Home country | Australia |
| Favourite things | |
| Colour | Blue |
| Association Football team | FC 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
[dezie ebe o si]Currently, {{infobox element}} has five {{engvar}} words. Phosphorus shows |engvar=en-UK despite the |engvar=en-US default.
Parameter list
[dezie ebe o si]Template
[dezie ebe o si]{{#invoke:engvar|variants
[[:Templeeti:Expand wikitext]]
Article
[dezie ebe o si]{{example
| engvar =
| engvarCat =
}}
List of English varieties
[dezie ebe o si]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 | en-US |
| Australian English | en-AU |
| British English | en-GB |
| Canadian English | en-CA |
| Hiberno-English (Irish English) | en-EI |
| Hong Kong English | en-HK |
| Indian English | en-IN |
| Jamaican English | en-JM |
| Malawian English | en-MW |
| New Zealand English | en-NZ |
| Nigerian English | en-NG |
| Pakistani English | en-PK |
| Philippine English | en-PH |
| Scottish English | en-SCO |
| Singapore English | en-SG |
| South African English | en-ZA |
| Trinidadian English | en-TT |
| British English Oxford spelling British (Oxford) English Oxford English Dictionary (OED) |
en-OED |
| IUPAC spelling | en-IUPAC |
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
[dezie ebe o si]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 {{example|engvar=South African English}} 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=noin 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 {{pagename}} 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
[dezie ebe o si]TemplateData for Engvar
Enweghị nkọwa.
| Oke | Nkọwa | Dee | Ọnọdụ | |
|---|---|---|---|---|
| Default spelling | defaultword | The default word, usually the word in the English variety most often used
| Eriri | Na-atụ aro |
| Default English variety | defaultLang | Adding this helps document your {{engvar}} setting
| Eriri | Na-atụ aro |
| English variety | engvar | 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.
| Eriri | Achọrọ |
| Suppress maintenance category | engvarCat | Enweghị nkọwa.
| Eriri | Na-atụ aro |
| Fallback | fallback | Whether Commonwealth English languages should fallback to en-GB if not specified
| Boolean | Nhọrọ |
| Maintenance category sort key | engvarCatSort | Enweghị nkọwa.
| Eriri | Nhọrọ |
| American English spelling | en-US | Enweghị nkọwa.
| Eriri | Nhọrọ |
| Australian English spelling | en-AU | Enweghị nkọwa. | Eriri | Nhọrọ |
| British English spelling | en-GB | Enweghị nkọwa. | Eriri | Nhọrọ |
| Canadian English spelling | en-CA | Enweghị nkọwa. | Eriri | Nhọrọ |
| Hiberno-English (Irish-English) spelling | en-EI | Enweghị nkọwa. | Eriri | Nhọrọ |
| Hong Kong English spelling | en-HK | Enweghị nkọwa. | Eriri | Nhọrọ |
| Indian English spelling | en-IN | Enweghị nkọwa. | Eriri | Nhọrọ |
| Jamaican English spelling | en-JM | Enweghị nkọwa. | Eriri | Nhọrọ |
| Malawian English spelling | en-MW | Enweghị nkọwa. | Eriri | Nhọrọ |
| New Zealand English spelling | en-NZ | Enweghị nkọwa. | Eriri | Nhọrọ |
| Nigerian English spelling | en-NG | Enweghị nkọwa. | Eriri | Nhọrọ |
| Pakistani English spelling | en-PK | Enweghị nkọwa. | Eriri | Nhọrọ |
| Philippine English spelling | en-PH | Enweghị nkọwa. | Eriri | Nhọrọ |
| Scottish English spelling | en-SCO | Enweghị nkọwa. | Eriri | Nhọrọ |
| Singapore English spelling | en-SG | Enweghị nkọwa. | Eriri | Nhọrọ |
| South African English spelling | en-ZA | Enweghị nkọwa. | Eriri | Nhọrọ |
| Trinidadian English spelling | en-TT | Enweghị nkọwa. | Eriri | Nhọrọ |
| British (Oxford) English spelling | en-OED | Enweghị nkọwa. | Eriri | Nhọrọ |
| IUPAC spelling | en-IUPAC | Enweghị nkọwa. | Eriri | Nhọrọ |
See also
[dezie ebe o si]- HELP:ENGVAR
- Category:Articles using an unknown Template:Engvar option
- ISO 3166-1 alpha-2 -- The 2-letter country code
- {{#invoke:Engvar|explain|...}} - debugging