Difference between revisions of "Module:Engvar/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>DePiep
m (26 revisions imported)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{in use}}
+
This module is allows an article to show a '''national variant of English''' ([[WP:ENGVAR]]) in templates, depending on the individual article preference. Basically, the article page infobox can have {{para|engvar|en-GB}} set to show en-GB spellng.
This module is allows a template to show '''national variants of English''' ([[WP:ENGVAR]]) in templates, depending on the individual article preference. See also {{tl|Engvar}}.
 
  
 
For example, a single template can show "football" text in en-UK articles, and "soccer" in en-US articles.
 
For example, a single template can show "football" text in en-UK articles, and "soccer" in en-US articles.
  
== Usage ==
+
==Usage==
;1. In the template parameter list
+
See {{tl|Engvar}}.
Add {{para|engvar|}}. Can be used in an article. With this an editor can set a variant Engvar language for that article: {{para|engvar|en-US}}.
 
 
 
;2. Inside the template code, add like
 
<pre>
 
...
 
| label10 = Favorite {{engvar|defaultWord=football |defaultLang=en-UK |en-US=soccer}} team
 
|  data10 = {{{favorite team|}}}
 
...
 
</pre>
 
 
 
  
 
<pre>
 
<pre>
 +
{{#invoke:Engvar|variants
 
| defaultWord =
 
| defaultWord =
 +
| engvar = {{{engvar|}}}<!-- Pass through article setting -->
 
| defaultLang =
 
| defaultLang =
| engvar = {{{engvar|}}}
+
| en-XX = <!-- Add country code for XX, and its word -->
| en-XX = <!-- Add country code for XX, and the nation language word -->
 
 
| en-YY = <!-- Add more variants as might be needed -->
 
| en-YY = <!-- Add more variants as might be needed -->
| engvarcat = {{{engvarcat|}}}<!-- '=no' will suppress message category in article page) -->
+
| engvarCat = {{{engvarCat|}}}
 +
| engvarCatSort =
 +
}}
 
</pre>
 
</pre>
  
;{{para|1=defaultWord}}
+
;{{para|engvar}}
:The word (or sentence) that will be shown by default. Pick the language one that is most often used (no preference involved).
+
This input (user input) is checked against a list of possible words ("en-US, American English, United States"). Internal identifier is the code like "en-US".
  
;{{para|1=defaultLang}}
+
;{{para|engvarCatSort}}
:Not absolutely required, but it helps documenting your {{tlf|engvar}} addition. Also, adding this prevents an article appear in the maintenance category (in case the editor asks, trivially, for the default language).
+
Sort text for maintenance category. Advise to set to project name like "rainbow" not "infobox rainbow" (all templates will fill this category!). Default is pagename.
  
;{{para|1=en-XX|2=soccer}}
+
;Maintenance category:
:Add all language variants by their language ''code'' (listed below). Only those languages that differ from the default are needed. Also, only list the languages that are likely to be used in the template. Is the templAte used in articles in Jamaican English language?
 
 
 
==The maintenance category==
 
:The editors language request may '''not be available'' in your template code. For example, an {{para|engvar|South African English}} is asked for, but is not in the variants list you entered, so can not be honored; the defaultWord is shown. You can check that category for those requests, and maybe improve your template.
 
:When this categorisation is not wanted, you can ''set'' this parameter {{para|engvarcat|no}} in code for the whole of your template (template will never add this category).
 
:You can also ''pass-through'' this value: {{para|engvarcat|1=<nowiki>{{{engvarcat|yes}}}</nowiki>}}. This allows the editor to switch categorization off per article.
 
 
 
;engvarcat
 
:{{para|engvarcat|no}} will suppress (prevent) the ''maintenance category'' to be added to an article page.
 
:Default: when the article's {{para=engvar|en-CA}} is not found in the variants list (in the tempalte), the article is listed in this category. It indicates that your template has requests for another natrional variant.
 
:In these cases, the article will show the defaultWord
 
 
*[[:Category:Articles using an unknown Template:Engvar option]]
 
*[[:Category:Articles using an unknown Template:Engvar option]]
  
Line 54: Line 35:
 
| en-XX = <!-- add country code for XX, and the nation language word -->
 
| en-XX = <!-- add country code for XX, and the nation language word -->
 
| en-YY = <!-- add more variants as might be needed -->
 
| en-YY = <!-- add more variants as might be needed -->
| engvarcat = {{{engvarcat|}}} <!-- '=no' will suppress message category in article page) -->
+
| engvarCat = {{{engvarCat|}}} <!-- yes/no; '=no' will suppress message category in article page) -->
 
</pre>
 
</pre>
  
Line 60: Line 41:
 
<pre>
 
<pre>
 
| engvar =
 
| engvar =
| engvarcat =
+
| engvarCat =
 
</pre>
 
</pre>
  
 
==List of variant languages==
 
==List of variant languages==
In the template code, use the ISO-code as parameter name:
+
In the ''template code'' only use the listed ISO-code as parameter name: {{para|en-UK|vapour}}. The ''article editor'' has freedom to use the other options: {{para|engvar|British}}.
{{para|en-UK|vapour}}
 
  
 
{| class="wikitable sortable collapsible uncollapsed" style="min-width:50%;"
 
{| class="wikitable sortable collapsible uncollapsed" style="min-width:50%;"
Line 111: Line 91:
 
|-
 
|-
 
| [[Scottish English]]
 
| [[Scottish English]]
| en-SCOTLAND
+
| en-SCO
 
|-
 
|-
 
| [[Singapore English]]
 
| [[Singapore English]]
Line 123: Line 103:
 
|-
 
|-
 
| {{hidden sort key|_Oxford}}British English [[Oxford spelling]]<br/>British (Oxford) English<br/>''[[Oxford English Dictionary]]'' (OED)
 
| {{hidden sort key|_Oxford}}British English [[Oxford spelling]]<br/>British (Oxford) English<br/>''[[Oxford English Dictionary]]'' (OED)
| {{hidden sort key|_Oxford}}en-EOD
+
| {{hidden sort key|_Oxford}}en-OED
 
|-
 
|-
 
| {{hidden sort key|_IUPAC}}IUPAC spelling
 
| {{hidden sort key|_IUPAC}}IUPAC spelling
 
| {{hidden sort key|_IUPAC}}en-IUPAC
 
| {{hidden sort key|_IUPAC}}en-IUPAC
|-
 
| {{hidden sort key|_IUPAC-US}}IUPAC spelling US
 
| {{hidden sort key|_Oxford}}en-IUPAC
 
 
|}
 
|}
 
*[[HELP:ENGVAR]]
 
*[[HELP:ENGVAR]]
 
*[[:Category:Articles using an unknown Template:Engvar option]]
 
*[[:Category:Articles using an unknown Template:Engvar option]]
 
*[[ISO 3166-1 alpha-2]] 2-letter country code
 
*[[ISO 3166-1 alpha-2]] 2-letter country code
 
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
 
<!-- Categories go here and interwikis go in Wikidata. -->
 
<!-- Categories go here and interwikis go in Wikidata. -->
 
+
[[Category:Varieties of English templates|*, {{PAGENAME}}]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 16:28, 26 September 2020

This module is allows an article to show a national variant of English (WP:ENGVAR) in templates, depending on the individual article preference. Basically, the article page infobox can have |engvar=en-GB set to show en-GB spellng.

For example, a single template can show "football" text in en-UK articles, and "soccer" in en-US articles.

Usage

See {{Engvar}}.

{{#invoke:Engvar|variants
| defaultWord =
| engvar = {{{engvar|}}}<!-- Pass through article setting -->
| defaultLang =
| en-XX = <!-- Add country code for XX, and its word  -->
| en-YY = <!-- Add more variants as might be needed -->
| engvarCat = {{{engvarCat|}}}
| engvarCatSort =
}}
|engvar=

This input (user input) is checked against a list of possible words ("en-US, American English, United States"). Internal identifier is the code like "en-US".

|engvarCatSort=

Sort text for maintenance category. Advise to set to project name like "rainbow" not "infobox rainbow" (all templates will fill this category!). Default is pagename.

Maintenance category

Parameter list

In the

| defaultWord =
| defaultLang =
| engvar = {{{engvar|}}}<!-- Pass through the editor's choice -->
| en-XX = <!-- add country code for XX, and the nation language word -->
| en-YY = <!-- add more variants as might be needed -->
| engvarCat = {{{engvarCat|}}} <!-- yes/no; '=no' will suppress message category in article page) -->

In the parameter list, for the editor to see & use:

| engvar =
| engvarCat =

List of variant languages

In the template code only use the listed ISO-code as parameter name: |en-UK=vapour. The article editor has freedom to use the other options: |engvar=British.

Language 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