Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Template:Engvar/doc
Template
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
Move
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{High-use}} {{Lua|module:Engvar}} This template is used inside other templates. <section begin="ledeMinusLeadSentence" />It allows templates to show '''[[WP:ENGVAR|national varieties of English]]''', when {{para|engvar}} is passed by each article. For example, one template can display "football" for {{para|engvar|en-UK}} articles, and "soccer" for {{para|engvar|en-US}} articles.<section end="ledeMinusLeadSentence" /> ==Usage== # '''Articles''' specify the English variety parameter for relevant templates like {{tlc|example|engvar{{=}}en-US}}. They do not use {{tlc|engvar}}. # '''Templates''' use {{tlc|engvar}}. It should not forget to pass-through {{para|engvar|<nowiki>{{{engvar|}}}</nowiki>}} <syntaxhighlight lang="wikitext"> ... | 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|}}} ... </syntaxhighlight> The {{para|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 {{para|engvar}} is specified by the article. The word can be changed in an American English article by that article specifying {{para|engvar|en-US}}. The fallback 'auto' value means it will try to determine the language based on templates like {{tl|Use British English}} or {{tl|Use American English}} being present on the page if no engvar is specified. '''Note''': {{tlc|engvar}} is unrelated to parameter names like {{para|color}} vs. {{para|colour}}. See programming option {{para|data3|<nowiki>{{{color|{{{colour|}}} }}}</nowiki>}} ===Example=== Consider an example template, a fictive {{tlf|infobox personal likes}}. The demo is encoded in {{t|Engvar/doc/infobox demo}}. ====Template code==== {{#tag:syntaxhighlight|{{#invoke:DecodeEncode|decode|s={{msgnw:Template:Engvar/doc/infobox demo}}}}|lang=wikitext}} ====Three articles==== {{demo|<nowiki>{{Engvar/doc/infobox demo | home country = Wales | color = Blue | team = [[FC Kuusysi]] <!-- |engvar= not set; expect defaults --> }}</nowiki>|reverse=1}} {{clear}} {{demo|<nowiki>{{Engvar/doc/infobox demo | home country = Alaska | color = Blue | team = [[FC Kuusysi]] | engvar= en-US }}</nowiki>|reverse=1}} {{clear}} {{demo|<nowiki>{{Engvar/doc/infobox demo | home country = Australia | color = Blue | team = [[FC Kuusysi]] | engvar= Australian }}</nowiki>|reverse=1}} ===A live example=== Currently, {{tl|infobox element}} has five {{tlf|engvar}} words. [[Phosphorus]] shows {{para|engvar|en-UK}} despite the {{para|engvar|en-US}} default. ==Parameter list== ===Template=== {{#tag:syntaxhighlight|{{module other|{{((}}#invoke:engvar{{!}}variants|{{((}}engvar}} {{#invoke:DecodeEncode|decode|s={{expand wikitext|1=<nowiki> | defaultWord = | defaultLang = | engvar = {{{engvar|}}}<!-- Pass-through the editor's choice, set to 'auto' to automatically detect --> | en-XX = <!-- add country code for XX, and the nation language word --> | en-YY = <!-- add more varieties as might be needed --> | engvarCat = {{{engvarCat|}}} <!-- '=no' will suppress message category in article page --> | fallback = <!-- set to 'true' to allow commonwealth languages to fallback to 'en-GB'. False by default unless engvar='auto'. --> }}</nowiki>}}}}|lang=wikitext}} ===Article=== <syntaxhighlight lang="wikitext"> {{example | engvar = | engvarCat = }} </syntaxhighlight> == List of English varieties== In the ''template'', use the ''exact'' ISO-code as the parameter name like {{para|en-GB|vapour}}. Write {{para|en-US|soccer|green=1}} not {{para|American English|soccer|red=1}}. Needed varieties have articles using the template and words differing from the default. {{anchor|List of Engvar codes|List of variety languages}} {| class="wikitable sortable collapsible uncollapsed" style="min-width:50%;" ! English variety<!--All English varieties are part of the single English language--> ! ISO-code |- | [[American English]] | {{pval|en-US}} |- | [[Australian English]] | {{pval|en-AU}} |- | [[British English]] | {{pval|en-GB}} |- | [[Canadian English]] | {{pval|en-CA}} |- | [[Hiberno-English]] (Irish-English) | {{pval|en-EI}} |- | [[Hong Kong English]] | {{pval|en-HK}} |- | [[Indian English]] | {{pval|en-IN}} |- | [[Jamaican English]] | {{pval|en-JM}} |- | [[Malawian English]] | {{pval|en-MW}} |- | [[New Zealand English]] | {{pval|en-NZ}} |- | [[Nigerian English]] | {{pval|en-NG}} |- | [[Pakistani English]] | {{pval|en-PK}} |- | [[Philippine English]] | {{pval|en-PH}} |- | [[Scottish English]] | {{pval|en-SCO}} |- | [[Singapore English]] | {{pval|en-SG}} |- | [[South African English]] | {{pval|en-ZA}} |- | [[Trinidadian English]] | {{pval|en-TT}} |- | data-sort-value="_Oxford" | British English [[Oxford spelling]]<br/>British (Oxford) English<br/>''[[Oxford English Dictionary]]'' (OED) | data-sort-value="_Oxford" | {{pval|en-OED}} |- | data-sort-value="_IUPAC" | IUPAC spelling | data-sort-value="_IUPAC" | {{pval|en-IUPAC}} |} There is backwards compatibility for leeway in ''articles''. {{para|engvar|en-US}}, {{para|engvar|United States}}, {{para|engvar|US}} can all show the {{para|en-US|football}} variety. ==Maintenance category== Articles with an invalid {{para|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 {{para|engvar}} may be unspecified in the template. For example, if an article uses {{tlc|example|engvar{{=}}South African English}} but the template has no {{para|en-ZA}}, then the template will return {{para|defaultWord|default color name}}. The category will not be used. :When this categorization is not desired for a whole template, set {{para|engvarCat|no}} in the template :Otherwise pass-through this setting from the article: {{para|engvarCat|<nowiki>{{{engvarCat|yes}}}</nowiki>}}. This allows the editor to switch categorization off per article. Articles are sorted by {{para|engvarCatSort}} or {{magic word|pagename}} by default. Note that other templates will fill this category. Set this parameter like {{para|engvarCatSort|Personal prefs}} in a template to group its listings under "P". ==Template data== {{Template data header}} <templatedata> { "params": { "defaultword": { "label": "Default spelling", "type": "string", "example": "colour", "suggested": true, "description": "The default word, usually the word in the English variety most often used" }, "defaultLang": { "label": "Default English variety", "type": "string", "example": "en-US", "suggested": true, "suggestedvalues": [ "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" ], "description": "Adding this helps document your {{engvar}} setting" }, "engvar": { "label": "English variety", "type": "string", "suggestedvalues": [ "{{{engvar|auto}}}", "{{{engvar|}}}", "auto" ], "required": true, "description": "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." }, "engvarCat": { "label": "Suppress maintenance category", "type": "string", "suggestedvalues": [ "{{{engvarCat|yes}}}", "no" ], "default": "yes", "suggested": true }, "engvarCatSort": { "label": "Maintenance category sort key", "type": "string", "default": "{{pagename}}" }, "en-US": { "label": "American English spelling", "type": "string", "example": "color" }, "en-AU": { "label": "Australian English spelling", "type": "string" }, "en-GB": { "label": "British English spelling", "type": "string" }, "en-CA": { "label": "Canadian English spelling", "type": "string" }, "en-EI": { "label": "Hiberno-English (Irish-English) spelling", "type": "string" }, "en-HK": { "label": "Hong Kong English spelling", "type": "string" }, "en-IN": { "label": "Indian English spelling", "type": "string" }, "en-JM": { "label": "Jamaican English spelling", "type": "string" }, "en-MW": { "label": "Malawian English spelling", "type": "string" }, "en-NZ": { "label": "New Zealand English spelling", "type": "string" }, "en-NG": { "label": "Nigerian English spelling", "type": "string" }, "en-PK": { "label": "Pakistani English spelling", "type": "string" }, "en-PH": { "label": "Philippine English spelling", "type": "string" }, "en-SCO": { "label": "Scottish English spelling", "type": "string" }, "en-SG": { "label": "Singapore English spelling", "type": "string" }, "en-ZA": { "label": "South African English spelling", "type": "string" }, "en-TT": { "label": "Trinidadian English spelling", "type": "string" }, "en-OED": { "label": "British (Oxford) English spelling", "type": "string" }, "en-IUPAC": { "label": "IUPAC spelling", "type": "string" }, "fallback": { "label": "Fallback", "description": "Whether Commonwealth English languages should fallback to en-GB if not specified", "type": "boolean", "default": "false unless engvar=auto" } }, "paramOrder": [ "defaultword", "defaultLang", "engvar", "engvarCat", "fallback", "engvarCatSort", "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" ] } </templatedata> ==See also== *[[HELP:ENGVAR]] *[[:Category:Articles using an unknown Template:Engvar option]] *[[ISO 3166-1 alpha-2]] -- The 2-letter country code *{{ml|Engvar|explain|...}} - debugging <includeonly>{{sandbox other||[[Category:Engvar]]}}</includeonly>
Summary:
Please note that all contributions to Ikwipedia are considered to be released under the Creative Commons Attribution-ShareAlike (see
Ikwipedia:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:((
(
edit
)
Template:Anchor
(
edit
)
Template:Clear
(
edit
)
Template:Demo
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Engvar
(
edit
)
Template:Engvar/doc/infobox demo
(
edit
)
Template:Expand wikitext
(
edit
)
Template:High-use
(
edit
)
Template:Infobox
(
edit
)
Template:Lua
(
edit
)
Template:Magic word
(
edit
)
Template:Mbox
(
edit
)
Template:Ml
(
edit
)
Template:Module link
(
edit
)
Template:Module other
(
edit
)
Template:Nowrap
(
edit
)
Template:Para
(
edit
)
Template:Param value
(
edit
)
Template:Pval
(
edit
)
Template:Replace
(
edit
)
Template:Sandbox other
(
edit
)
Template:Str left
(
edit
)
Template:Strong
(
edit
)
Template:T
(
edit
)
Template:TemplateData header
(
edit
)
Template:Template data header
(
edit
)
Template:Template link
(
edit
)
Template:Template link code
(
edit
)
Template:Template link with link off
(
edit
)
Template:Template other
(
edit
)
Template:Template parameter usage
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tl
(
edit
)
Template:Tlc
(
edit
)
Template:Tlf
(
edit
)
Template:Yesno
(
edit
)
Template:Yesno-no
(
edit
)
Module:Anchor
(
edit
)
Module:Arguments
(
edit
)
Module:Check for unknown parameters
(
edit
)
Module:DecodeEncode
(
edit
)
Module:Demo
(
edit
)
Module:Engvar
(
edit
)
Module:Engvar/detect
(
edit
)
Module:Expand wikitext
(
edit
)
Module:High-use
(
edit
)
Module:Infobox
(
edit
)
Module:Infobox/styles.css
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Separated entries
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Text/data
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/E
(
edit
)
Module:Yesno
(
edit
)
Toggle limited content width