Bước tới nội dung

Bản mẫu:Engvar/doc

Bách khoa toàn thư mở Wikipedia

This template is used inside other templates. It allows templates to show national varieties of English, when |engvar= is passed by each article.

For example, one template can display "football" for |engvar=en-UK articles, and "soccer" for |engvar=en-US articles.

Usage Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

  1. Articles specify the English variety parameter for relevant templates like {{example|engvar=en-US}}. They do not use {{engvar}}.
  2. Templates use {{engvar}}. It should not forget to pass-through |engvar={{{engvar|}}}
...| 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|}}}...

The |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 |engvar= is specified by the article. The word can be changed in an American English article by that article specifying |engvar=en-US. The fallback 'auto' value means it will try to determine the language based on templates like {{Use British English}} or {{Use American English}} being present on the page if no engvar is specified.

Note: {{engvar}} is unrelated to parameter names like |color= vs. |colour=. See programming option |data3={{{color|{{{colour|}}} }}}

Example

Consider an example template, a fictive {{infobox personal likes}}. The demo is encoded in {{Engvar/doc/infobox demo}}.

Template code

{{infobox| title = Sở thích cá nhân| above = Mẫu: dùng [[WP:ENGVAR|WP:Engvar]] trong bản mẫu| abovestyle = background:#ddd; font-weight:normal; font-size:smaller;| headerstyle = background:lemonchiffon| label1 = Home country {{small|(Quê gốc)}}| data1 = {{{home country|}}}| header2 = {{engvar|defaultWord=Favourite |defaultLang=en-GB | engvar={{{engvar|auto}}} |en-US=Favorite }} things {{small|(Thứ yêu thích)}}| label3 = {{engvar|defaultWord=Colour |defaultLang=en-GB | engvar={{{engvar|auto}}} |en-US=Color }} {{small|(Màu)}}| data3 = {{{color|}}}| label4 = {{engvar|defaultWord=Football |defaultLang=en-GB | engvar={{{engvar|auto}}} |en-US=Soccer |en-AU=Association Football}} team {{small|(Đội tuyển bóng đá)}}| data4 = {{{team|}}}| below = Trong 'bài viết' mẫu này có thiết lập tham số bản mẫu: {{para|1=engvar|2={{{engvar|(unspecified)}}}}}| belowstyle = background:#ddd;}}

Three articles

Sở thích cá nhân
Mẫu: dùng WP:Engvar trong bản mẫu
Home country (Quê gốc)Wales
Favourite things (Thứ yêu thích)
Colour (Màu)Blue
Football team (Đội tuyển bóng đá)FC Kuusysi
Trong 'bài viết' mẫu này có thiết lập tham số bản mẫu: |engvar=(unspecified)
{{Engvar/doc/infobox demo| home country = Wales| color = Blue| team = [[FC Kuusysi]]<!-- |engvar= not set; expect defaults -->}}
Sở thích cá nhân
Mẫu: dùng WP:Engvar trong bản mẫu
Home country (Quê gốc)Alaska
Favorite things (Thứ yêu thích)
Color (Màu)Blue
Soccer team (Đội tuyển bóng đá)FC Kuusysi
Trong 'bài viết' mẫu này có thiết lập tham số bản mẫu: |engvar=en-US
{{Engvar/doc/infobox demo| home country = Alaska| color = Blue| team = [[FC Kuusysi]]| engvar= en-US}}
Sở thích cá nhân
Mẫu: dùng WP:Engvar trong bản mẫu
Home country (Quê gốc)Australia
Favourite things (Thứ yêu thích)
Colour (Màu)Blue
Association Football team (Đội tuyển bóng đá)FC Kuusysi
Trong 'bài viết' mẫu này có thiết lập tham số bản mẫu: |engvar=Australian
{{Engvar/doc/infobox demo| home country = Australia| color = Blue| team = [[FC Kuusysi]]| engvar= Australian}}

A live example

Currently, {{infobox element}} has five {{engvar}} words. Phosphorus shows |engvar=en-UK despite the |engvar=en-US default.

Parameter list Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

Template

{{engvar| defaultWord =| defaultLang =| 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 = <!-- '=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'. -->}}

Article

{{example| engvar =| engvarCat =}}

List of English varieties Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

In the template, use the exact ISO-code as the parameter name like |en-GB=vapour. Write |en-US=soccer not |American English=soccer. Needed varieties have articles using the template and words differing from the default.

English varietyISO-code
American Englishen-US
Australian Englishen-AU
British Englishen-GB
Canadian Englishen-CA
Hiberno-English (Irish English)en-EI
Hong Kong Englishen-HK
Indian Englishen-IN
Jamaican Englishen-JM
Malawian Englishen-MW
New Zealand Englishen-NZ
Nigerian Englishen-NG
Pakistani Englishen-PK
Philippine Englishen-PH
Scottish Englishen-SCO
Singapore Englishen-SG
South African Englishen-ZA
Trinidadian Englishen-TT
British English Oxford spelling
British (Oxford) English
Oxford English Dictionary (OED)
en-OED
IUPAC spellingen-IUPAC

There is backwards compatibility for leeway in articles. |engvar=en-US, |engvar=United States, |engvar=US can all show the |en-US=football variety.

Maintenance category Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

Articles with an invalid |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 |engvar= may be unspecified in the template. For example, if an article uses {{example|engvar=South African English}} but the template has no |en-ZA=, then the template will return |defaultWord=default color name. The category will not be used.

When this categorization is not desired for a whole template, set |engvarCat=no in the template
Otherwise pass-through this setting from the article: |engvarCat={{{engvarCat|yes}}}. This allows the editor to switch categorization off per article.

Articles are sorted by |engvarCatSort= or {{pagename}} by default. Note that other templates will fill this category. Set this parameter like |engvarCatSort=Personal prefs in a template to group its listings under "P".

Template data Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho Engvar

Không có miêu tả.

Tham số bản mẫu

Tham sốMiêu tảKiểuTrạng thái
Default spellingdefaultword

The default word, usually the word in the English variety most often used

Ví dụ
colour
Chuỗi dàikhuyên dùng
Default English varietydefaultLang

Adding this helps document your {{engvar}} setting

Giá trị đề nghị
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
Ví dụ
en-US
Chuỗi dàikhuyên dùng
English varietyengvar

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.

Giá trị đề nghị
{{{engvar|auto}}} {{{engvar|}}} auto
Chuỗi dàibắt buộc
Suppress maintenance categoryengvarCat

không có miêu tả

Giá trị đề nghị
{{{engvarCat|yes}}} no
Mặc định
yes
Chuỗi dàikhuyên dùng
Fallbackfallback

Whether Commonwealth English languages should fallback to en-GB if not specified

Mặc định
false unless engvar=auto
Luận lýtùy chọn
Maintenance category sort keyengvarCatSort

không có miêu tả

Mặc định
{{pagename}}
Chuỗi dàitùy chọn
American English spellingen-US

không có miêu tả

Ví dụ
color
Chuỗi dàitùy chọn
Australian English spellingen-AU

không có miêu tả

Chuỗi dàitùy chọn
British English spellingen-GB

không có miêu tả

Chuỗi dàitùy chọn
Canadian English spellingen-CA

không có miêu tả

Chuỗi dàitùy chọn
Hiberno-English (Irish-English) spellingen-EI

không có miêu tả

Chuỗi dàitùy chọn
Hong Kong English spellingen-HK

không có miêu tả

Chuỗi dàitùy chọn
Indian English spellingen-IN

không có miêu tả

Chuỗi dàitùy chọn
Jamaican English spellingen-JM

không có miêu tả

Chuỗi dàitùy chọn
Malawian English spellingen-MW

không có miêu tả

Chuỗi dàitùy chọn
New Zealand English spellingen-NZ

không có miêu tả

Chuỗi dàitùy chọn
Nigerian English spellingen-NG

không có miêu tả

Chuỗi dàitùy chọn
Pakistani English spellingen-PK

không có miêu tả

Chuỗi dàitùy chọn
Philippine English spellingen-PH

không có miêu tả

Chuỗi dàitùy chọn
Scottish English spellingen-SCO

không có miêu tả

Chuỗi dàitùy chọn
Singapore English spellingen-SG

không có miêu tả

Chuỗi dàitùy chọn
South African English spellingen-ZA

không có miêu tả

Chuỗi dàitùy chọn
Trinidadian English spellingen-TT

không có miêu tả

Chuỗi dàitùy chọn
British (Oxford) English spellingen-OED

không có miêu tả

Chuỗi dàitùy chọn
IUPAC spellingen-IUPAC

không có miêu tả

Chuỗi dàitùy chọn

See also Bản mẫu:Engvar/doc Bản mẫu:Engvar/doc

  • HELP:ENGVAR
  • Thể loại:Bài viết sử dụng tham số Bản mẫu:Engvar không rõ
  • ISO 3166-1 alpha-2 -- The 2-letter country code
  • {{#gọi:Engvar|explain|...}} - debugging