Difference between revisions of "Template:Engvar/doc"
Jump to navigation
Jump to search
imported>DePiep (→Todo: rewrite the doc) |
(reverting idiot's edit) |
||
| Line 3: | Line 3: | ||
== Usage == | == Usage == | ||
| − | This template can be used in templates that are used on pages with | + | This template can be used in templates that are used on pages with English language variants: articles in en-UK and articles in en-US. At the moment only UK and US English are recognised. |
| − | '''Article editor | + | '''Article editor''' |
| + | When using the template in an article, the editor can set its parameter {{code|<nowiki>|engvar=en-UK</nowiki>}}. The template text now will use the provided en-UK variant of words. This parameter setting is only needed once in thetemplate. | ||
| − | '''In the template | + | '''In the template''' |
| + | So the template takes ''input parameter'' {{code|<nowiki>{{{engvar}}}</nowiki>}} Internally, the template has this construct: | ||
<pre> | <pre> | ||
... | ... | ||
| Line 13: | Line 15: | ||
... | ... | ||
</pre> | </pre> | ||
| − | Depending on the engvar input, it returns | + | Depending on the engvar input, it returns oneofthevalues. |
| − | + | '''Notes'''<br /> | |
| − | + | '''Language ids''' that are recognised are:<br /> | |
| − | + | # In article code (article editor; case insensitive): | |
| − | * {{code|1= | + | * {{code|1=engval= en-UK, UK, en-uk, uk}} → returns the en-UK value |
| − | * {{code|1= | + | * {{code|1=engval= en-US, US, en-us, us}} → returns the en-US value |
| − | |||
| − | + | # In template code (template editor): | |
| − | * Here, always use the lowercase language id | + | * Here, always use the lowercase language id: {{code|1=uk-en=Football}} (NOT {{code|1=uk-EN=Football}}) |
| − | * Recognised language id's: {{code|1=en-uk= | + | * Recognised language id's: {{code|1=en-uk=, uk=, en-us=, us=}} |
| − | + | # '''Unnamed parameters''' in template code can be used: | |
| − | |||
* Unnamed parameter 1=pass throught the {{code|<nowiki>{{{engvar}}}</nowiki>}} variable. Named: {{code|<nowiki>engvar={{{engvar}}}</nowiki>}} | * Unnamed parameter 1=pass throught the {{code|<nowiki>{{{engvar}}}</nowiki>}} variable. Named: {{code|<nowiki>engvar={{{engvar}}}</nowiki>}} | ||
| − | * Unnamed parameter 2=en-UK | + | * Unnamed parameter 2=en-UK definition |
| − | * Unnamed parameter 3=en-US | + | * Unnamed parameter 3=en-US definition |
| − | |||
<pre> | <pre> | ||
| − | <!-- The next | + | <!-- The next three rows are equal in template code: --> |
... | ... | ||
| label= {{engvar| engvar={{{engvar|}}} | en-uk=Football | en-us=Soccer }} | | label= {{engvar| engvar={{{engvar|}}} | en-uk=Football | en-us=Soccer }} | ||
| + | | label= {{engvar| 1={{{engvar|}}} | 2=Football | 3=Soccer }} | ||
| label= {{engvar| 1={{{engvar|}}} | uk=Football | us=Soccer }} | | label= {{engvar| 1={{{engvar|}}} | uk=Football | us=Soccer }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
... | ... | ||
</pre> | </pre> | ||
| − | + | '''Plain "en" variant''' | |
| − | ''' | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | = | + | Default and plain "en" |
| − | + | # When the engvar=value from the article is not recognised, te | |
== See also == | == See also == | ||
| − | |||
<includeonly> | <includeonly> | ||
Revision as of 23:22, 21 June 2012
| This is a documentation subpage for Template:Engvar. It contains usage information, categories and other content that is not part of the original template page. |
Usage
This template can be used in templates that are used on pages with English language variants: articles in en-UK and articles in en-US. At the moment only UK and US English are recognised.
Article editor
When using the template in an article, the editor can set its parameter |engvar=en-UK. The template text now will use the provided en-UK variant of words. This parameter setting is only needed once in thetemplate.
In the template
So the template takes input parameter {{{engvar}}} Internally, the template has this construct:
...
| label= {{engvar| engvar={{{engvar}}} | en-uk=Football | en-us=Soccer }}
...
Depending on the engvar input, it returns oneofthevalues.
Notes
Language ids that are recognised are:
- In article code (article editor; case insensitive):
engval= en-UK, UK, en-uk, uk→ returns the en-UK valueengval= en-US, US, en-us, us→ returns the en-US value
- In template code (template editor):
- Here, always use the lowercase language id:
uk-en=Football(NOTuk-EN=Football) - Recognised language id's:
en-uk=, uk=, en-us=, us=
- Unnamed parameters in template code can be used:
- Unnamed parameter 1=pass throught the
{{{engvar}}}variable. Named:engvar={{{engvar}}} - Unnamed parameter 2=en-UK definition
- Unnamed parameter 3=en-US definition
<!-- The next three rows are equal in template code: -->
...
| label= {{engvar| engvar={{{engvar|}}} | en-uk=Football | en-us=Soccer }}
| label= {{engvar| 1={{{engvar|}}} | 2=Football | 3=Soccer }}
| label= {{engvar| 1={{{engvar|}}} | uk=Football | us=Soccer }}
...
Plain "en" variant
Default and plain "en"
- When the engvar=value from the article is not recognised, te