Template:Engvar/doc

This template can be used inside a template. It allows the template to show national variants of English (WP:ENGVAR), depending on the individual article preference.

For example, the same template can show the word "football" text in en-UK articles, and "soccer" in en-US articles.

Usage
Add engvar to the parameter list. To be used in an article. With this parameter an editor sets a variant Engvar language: en-US.
 * 1. For the editors, add the parameter

... ...
 * 2. Inside the template code, add like
 * label3 =
 * data3 =

First, the defaultWord entered in the template will be shown. But when an article asks for a variant language, that alternative word &mdash;when found in the list&mdash;will be shown. The article editor has some freedom in words: en-US, United States, US all lead to the listed football variant.

Note that the template parameter (user value) is passed through: |engvar=

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:
 * label4 = team
 * data4 =

Note: Parameter names like color vs. colour are not affected at all. Existing names do not change by this template in any way. (See programming option )

Example
Below is an example template, a fictive. The demo is encoded in. Template code

Three articles:

A live example Currently, infobox element has five words. Default is en-US, and phosphorus shows its setting is en-UK.

More details

 * defaultWord =
 * defaultLang =
 * engvar =
 * en-XX =
 * en-YY =
 * engvarCat =


 * defaultWord
 * The word (or sentence) that will be shown by default. Pick the language one that is most often used (no preference involved).


 * engvar
 * Add  to the template. This passes through the article's setting to the internal Engvar template for processing.


 * en-XX, en-YY
 * Add the alternative language variant(s). Only those languages (words) that differ from the default are needed. Also, only list the languages that are likely to be used in the template. Will the template be used in Jamaican English language articles?


 * In the template code, use the listed codes only:,  ,  , etcetera. So in the template code, write , not  (the textual freedom is available for the article editor).


 * defaultLang
 * Not required. Use an  code. Adding this helps documenting your  setting. See also Maintenance category below.


 * engvarCat
 * no will suppress (prevent) the maintenance category to be added to an article page. See Maintenance category below.

Parameter list
In the
 * defaultWord =
 * defaultLang =
 * engvar =
 * en-XX =
 * en-YY =
 * engvarCat =

In the parameter list, for the editor to see & use:
 * engvar =
 * engvarCat =

List of variant languages
In the template code, use the exact ISO-code as parameter name: vapour (The need for precision it with the template encoder. Then for the article editor are the leeways such as variant language names).
 * HELP:ENGVAR


 * ISO 3166-1 alpha-2 2-letter country code

The maintenance category
Articles that can not resolve the Engvar request (The engvar for the template can not be resolved), will be placed in the hidden maintenance category:
 * Category:Articles using an unknown Template:Engvar option

Articles listed here can indicate that the may need adjustment (or the article needs a correction).

The editors Engvar request may not be available in your template code. For example, an South African English is asked for, but is not in the variants list you entered, so can not be honored (the  is shown). You can check the maintenance category for those requests, and maybe improve the template.
 * When this categorization is not wanted desired for a page or a whole tempalte, parameter no can be set in code for the whole of the template ( = the template will never add this category).
 * The template can also pass-through this setting from the article: engvarCat. This allows the editor to switch categorization off per article.

Articles are sorted by engvarCatSort (or pagename by default). Note that all templates will be filling this category. Set this parameter to group all template reports (e.g. Personal prefs will group this templates listings under "P").


 * The module has a debugging option  to give feedback on the arguments entered.