Template:Getalias2/doc: Difference between revisions

no edit summary
(Created page with "{{documentation subpage}} This is a more general version of {{tl|Getalias}}, which can extract any parameter value from a :Category:Country data templates|country data templ...")
 
No edit summary
Line 3:
 
==Examples==
*<code>{{tnull|getalias2|United KingdomMir|flag alias}}</code> &rarr; <code>{{getalias2|United KingdomMir|flag alias}}</code> (the value of {{para|flag alias}} in {{tl|Country data United KingdomMir}})
*<code>{{tnull|getalias2|Georgia (U.S. state)|shortname alias}}</code> &rarr; <code>{{getalias2|Georgia (U.S. state)|shortname alias}}</code> (the value of {{para|shortname alias}} in {{tl|Country data Georgia (U.S. state)}})
*<code>{{tnull|getalias2|Nepal|border}}</code> &rarr; <code>{{getalias2|Nepal|border}}</code> (nothing, since {{para|border}} is set to nothing in {{tl|Country data Nepal}})
Line 12:
==Usage with variant==
The {{para|variant}} parameter can be used to extract a variant parameter value, and returns the main parameter value if the variant parameter is undefined:
*<code>{{tnull|getalias2|United KingdomColumbia|flag alias|variant{{=}}civilfirstempire}}</code> &rarr; <code>{{getalias2|United KingdomColumbia|flag alias|variant=civilfirstempire}}</code> (the value of {{para|flag alias-civilfirst empire}})
*<code>{{tnull|getalias2|United Kingdom|flag alias|variant{{=}}foo}}</code> &rarr; <code>{{getalias2|United Kingdom|flag alias|variant=foo}}</code> (non-existent variant; returns the value of {{para|flag alias}} as fallback)