Bản mẫu: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.

**Cách sử dụng**
1. For the editors, add the parameter
Add  to the parameter list. To be used in an article. With this parameter an editor sets a variant Engvar language: en-US.
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 —when found in the list—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: 
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 )

**Ví dụ**
Below is an example template, a fictive infobox personal likes. The demo is encoded in Engvar/infobox demo.
Mã bản mẫu
Ba bài viết:
A live example
Currently, infobox element has five engvar words. Default is en-US, and Phosphorus shows its setting is en-UK.

**Thêm chi tiết**
defaultWord =
defaultLang =
engvar = {}
en-XX = 
en-YY = 
engvarCat = {}
1=defaultWord
The word (or sentence) that will be shown by default. Pick the language one that is most often used (no preference involved).

Add  to the template. This passes through the article's setting to the internal Engvar template for processing.
1=en-XX, 1=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: en-UK=, en-AU=, en-OED=, etcetera. So in the template code, write , not  (the textual freedom is available for the article editor).
1=defaultLang
Not required. Use an =en-ZZ code. Adding this helps documenting your engvar 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.

**Danh sách tham số**
In the
defaultWord =
defaultLang =
engvar = {}
en-XX = 
en-YY = 
engvarCat = {} 
In the parameter list, for the editor to see & use:
engvar =
engvarCat =

**Danh sách các ngôn ngữ biến thể**
In the template code, use the exact ISO-code as parameter name:
(The need for precision it with the template encoder. Then for the article editor are the leeways such as variant language names).
*TRỢ GIÚP:ENGVAR
*ISO 3166-1 alpha-2 2-letter country code

**The maintenance category**
Articles that can not resolve the Engvar request (The  for the template can not be resolved), will be placed in the hidden maintenance category:
:Thể loại:Bài viết sử dụng một tùy chọn không biết bản mẫu:Engvar
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 defaultWord 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: . 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.

**Xem thêm**
TRỢ GIÚP:ENGVAR
*:Thể loại:Bài viết sử dụng một tùy chọn không biết bản mẫu:Engvar
*ISO 3166-1 alpha-2 -- The 2-letter country code