Difference between revisions of "Template:Getalias/doc"

From blackwiki
Jump to navigation Jump to search
imported>SiBr4
m (Better shortname example (alias in China template is now same as shortname alias))
imported>SiBr4
(+)
Line 5: Line 5:
 
This is a meta-template that is not intended to be transcluded directly from the main article space.  It can be used to construct other templates that need to extract the <tt>alias</tt> value from the specified <tt>[[:Category:Country data templates|country_data]]</tt> structure, so that customized wikilinks can be constructed.  For example, <tt><nowiki>{{getalias|USA}}</nowiki></tt> → "{{getalias|USA}}".
 
This is a meta-template that is not intended to be transcluded directly from the main article space.  It can be used to construct other templates that need to extract the <tt>alias</tt> value from the specified <tt>[[:Category:Country data templates|country_data]]</tt> structure, so that customized wikilinks can be constructed.  For example, <tt><nowiki>{{getalias|USA}}</nowiki></tt> → "{{getalias|USA}}".
  
Use <tt>shortname</tt> as a second parameter to retrieve the <tt>shortname alias</tt> value if desired.  For example, <tt><nowiki>{{getalias|IRL}}</nowiki></tt> → "{{getalias|IRL}}", but <tt><nowiki>{{getalias|IRL|shortname}}</nowiki></tt> → "{{getalias|IRL|shortname}}".
+
Use <tt>shortname</tt> as a second parameter to retrieve the <tt>shortname alias</tt> value if desired.  For example, <tt><nowiki>{{getalias|IRL}}</nowiki></tt> → "{{getalias|IRL}}", but <tt><nowiki>{{getalias|IRL|shortname}}</nowiki></tt> → "{{getalias|IRL|shortname}}". To extract the flag image name, use <tt>flag</tt> as second parameter: <tt><nowiki>{{getalias|CHN|flag}}</nowiki></tt> &rarr; "{{getalias|CHN|flag}}".
  
 
A third parameter can specify the variant, for example <nowiki>[[Image:{{getalias|USA|flag|1912}}|22px]]</nowiki> -> [[Image:{{getalias|USA|flag|1912}}|22px]] }}
 
A third parameter can specify the variant, for example <nowiki>[[Image:{{getalias|USA|flag|1912}}|22px]]</nowiki> -> [[Image:{{getalias|USA|flag|1912}}|22px]] }}

Revision as of 13:51, 26 March 2014

Usage

This is a meta-template that is not intended to be transcluded directly from the main article space. It can be used to construct other templates that need to extract the alias value from the specified country_data structure, so that customized wikilinks can be constructed. For example, {{getalias|USA}} → "United States".

Use shortname as a second parameter to retrieve the shortname alias value if desired. For example, {{getalias|IRL}} → "Republic of Ireland", but {{getalias|IRL|shortname}} → "Ireland". To extract the flag image name, use flag as second parameter: {{getalias|CHN|flag}} → "Flag of the People's Republic of China.svg".

A third parameter can specify the variant, for example [[Image:{{getalias|USA|flag|1912}}|22px]] -> Flag of the United States (1912-1959).svg }}

See also