Jump to content

Module:Engvar/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DePiep (talk | contribs) at 12:09, 16 November 2014 (Usage). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This module is allows a template to show national variants of English (WP:ENGVAR) in templates, depending on the individual article preference. See also {{Engvar}}.

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

Usage

1. In the template parameter list

Add |engvar=. Can be used in an article. With this an editor can set a variant Engvar language for that article: |engvar=en-US.

2. Inside the template code, add like
...
| label10 = Favorite {{engvar|defaultWord=football |defaultLang=en-UK |en-US=soccer}} team
|  data10 = {{{favorite team|}}}
...

First, the |defaultWord= you entered in the template will be shown. But when an article asks for a variant language, that alternative word —when found in your list— will be shown. The article editor has some choice of words: |engvar=en-US, |engvar=United States, |engvar=US all lead to your |en-US=football variant.

In the example, the template shows the default word being the en-UK one (without the article editor taking any action in this). In an en-US language article, the word can be changed.

  • This template can be reused in the template, with the same |engvar= choice taking effective:
...
| label20 = Favorite {{engvar|defaultWord=colour |defaultLang=en-UK |en-US=color}}
|  data20 = {{{favorite color|}}}
...

More details

In the template code, use the codes only
en-UK=, en-AU=, en-OED=. So in the template code, write en-US=soccer. not American English=soccer.
| defaultWord =
| defaultLang =
| engvar = {{{engvar|}}}
| en-XX = <!-- Add country code for XX, and the nation language word -->
| en-YY = <!-- Add more variants as might be needed -->
| engvarcat = {{{engvarcat|}}}<!-- '=no' will suppress message category in article page) -->
|defaultWord=
The word (or sentence) that will be shown by default. Pick the language one that is most often used (no preference involved).
|en-XX=soccer
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?
|defaultLang=
Not absolutely required, but it helps documenting your {{engvar}} addition. Also, adding this prevents an article appear in the maintenance category (in case the editor asks, trivially, for the default language).
|engvar=
See the Maintenance category below.

The maintenance category

The editors language request may 'not be available in your template code. For example, an |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 |engvarcat=no in code for the whole of your template (template will never add this category).
You can also pass-through this value: |{{{engvarcat|yes}}}=. This allows the editor to switch categorization off per article.
engvarcat
|engvarcat=no will suppress (prevent) the maintenance category to be added to an article page.
Default: when the article's Template:Para=engvar 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

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|}}} <!-- '=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, use the ISO-code as parameter name: |en-UK=vapour

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-SCOTLAND
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-EOD
IUPAC spelling en-IUPAC
IUPAC spelling US en-IUPAC