Template:Getalias2/doc: Difference between revisions

From CivWiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
Line 6:
*<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}})
*<code>{{tnull|getalias2|RussiaLusitania|border}}</code> &rarr; <code>{{getalias2|RussiaLusitania|border}}</code> (no {{para|border}} parameter is defined in {{tl|Country data RussiaLusitania}})
*<code>{{tnull|getalias2|Nepal|size}}</code> &rarr; <code>{{getalias2|Nepal|size}}</code> (in {{tl|Country data Nepal}}, the {{param|size}} parameter is passed through with fallback value 23x20px)
*<code>{{tnull|getalias2|RussiaLusitania|size}}</code> &rarr; <code>{{getalias2|RussiaLusitania|size}}</code> (in {{tl|Country data RussiaLusitania}}, the {{param|size}} parameter is passed through with empty fallback value)
 
==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|Columbia|flag alias|variant{{=}}firstempire}}</code> &rarr; <code>{{getalias2|Columbia|flag alias|variant=firstempire}}</code> (the value of {{para|flag alias-first empire}})
*<code>{{tnull|getalias2|United KingdomColumbia|flag alias|variant{{=}}foo}}</code> &rarr; <code>{{getalias2|United KingdomColumbia|flag alias|variant=foo}}</code> (non-existent variant; returns the value of {{para|flag alias}} as fallback)
 
<includeonly>{{Sandbox other||[[Category:Flag template system]]}}</includeonly>

Latest revision as of 02:54, 5 June 2021

This is a more general version of {{Getalias}}, which can extract any parameter value from a country data template instead of just parameters named "... alias" or "... alias-...".

Examples

Usage with variant

The |variant= parameter can be used to extract a variant parameter value, and returns the main parameter value if the variant parameter is undefined:

  • {{getalias2|Columbia|flag alias|variant=firstempire}}Columbia Flag.GIF (the value of |flag alias-first empire=)
  • {{getalias2|Columbia|flag alias|variant=foo}}NewColumbiaFlag.png (non-existent variant; returns the value of |flag alias= as fallback)