ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਫਰਮਾ: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.

1. For the editors, add the parameter

Add |engvar= to the parameter list. To be used in an article. With this parameter an editor sets a variant Engvar language: |engvar=en-US.

2. Inside the template code, add like
...
|label3 = {{engvar |defaultWord=Colour |defaultLang=en-UK |en-US=Color |engvar={{{engvar|}}} }}
| data3 = {{{color|}}}
...

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: |engvar=en-US, |engvar=United States, |engvar=US all lead to the listed |en-US=football variant.

Note that the template parameter (user value) is passed through: |engvar={{{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 = {{engvar|defaultWord=Football |defaultLang=en-UK |en-US=Soccer |engvar={{{engvar|}}} }} team
|  data4 = {{{team|}}}
...


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 |data3 = {{{color|{{{colour|}}} }}})

Example

[ਸੋਧੋ]

Below is an example template, a fictive {{infobox personal likes}}. The demo is encoded in {{Engvar/infobox demo}}. Template code

{{infobox
| title   = Personal likes
| headerstyle=background:lemonchiffon
| label1  = Home country
|  data1  = {{{home country|}}}
| header2 = Favorite things
|  label3 = {{engvar|defaultWord=Colour |defaultLang=en-UK | engvar={{{engvar|}}}
            |en-US=Color }}
|  data3  = {{{color|}}}
| label4  = {{engvar|defaultWord=Football |defaultLang=en-UK | engvar={{{engvar|}}}
            |en-US=Soccer |en-AU=Association Football}} team
|  data4  = {{{team|}}}}}

Three articles:

ਫਰਮਾ:Engvar/infobox demo

{{Engvar/infobox demo
| home country = Wales
| color = Blue
| team  = [[FC Kuusysi]]
| engvar=<!-- not set; expect defaults -->
}}

ਫਰਮਾ:Engvar/infobox demo

{{Engvar/infobox demo
| home country = Alaska
| color = Blue
| team  = [[FC Kuusysi]]
| engvar = en-US
}}

ਫਰਮਾ:Engvar/infobox demo

{{Engvar/infobox demo
| home country = Australia
| color = Blue
| team  = [[FC Kuusysi]]
| engvar = Australian
}}

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

More details

[ਸੋਧੋ]
| 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).
|engvar=
Add | engvar = {{{engvar|}}} 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: en-UK=, en-AU=, en-OED=, etcetera. So in the template code, write |en-US=soccer, not |American English=soccer (the textual freedom is available for the article editor).
|defaultLang=
Not required. Use an =en-ZZ code. Adding this helps documenting your {{engvar}} setting. See also Maintenance category below.
|engvarCat=
|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 = {{{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 exact ISO-code as parameter name: |en-GB=vapour (The need for precision it with the template encoder. Then for the article editor are the leeways such as variant language names).

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


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 |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 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 |engvarCat=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={{{engvarCat|yes}}}. 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. |engvarCatSort=Personal prefs will group this templates listings under "P").

  • The module has a debugging option {{#invoke:Engvar|explain|...}} to give feedback on the arguments entered.

Template data

[ਸੋਧੋ]
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for Template:Engvar based on its TemplateData.

TemplateData for Engvar

No description.

ਫਰਮੇ ਦੇ ਮਾਪਦੰਡ

ਮਾਪਦੰਡਵੇਰਵਾਕਿਸਮਦਰਜਾ
defaultworddefaultword

no description

Unknownoptional
engvarengvar

no description

Unknownoptional
word as spelled in language code en-XXen-XX

no description

Unknownoptional

See also

[ਸੋਧੋ]