Template:Sandbox/Aurelain/LinkIcon: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
-->1={{{1|no1}}},id={{{id|noid}}},lang={{{lang|nolang}}},type={{{type|notype}}},filename={{{filename|nofilename}}} | -->1={{{1|no1}}},id={{{id|noid}}},lang={{{lang|nolang}}},type={{{type|notype}}},filename={{{filename|nofilename}}} | ||
{{#cargo_query: | {{#cargo_query: | ||
tables = | tables = | ||
| Line 24: | Line 11: | ||
{{#if:{{{type|}}} | AND E.type = '{{{type}}}' }} | {{#if:{{{type|}}} | AND E.type = '{{{type}}}' }} | ||
AND E.language = 'en' | AND E.language = 'en' | ||
<!-- foreign language --> | |||
{{#if:{{{type|}}} | AND T.type = '{{{type}}}' }} | {{#if:{{{type|}}} | AND T.type = '{{{type}}}' }} | ||
AND T.language = '{{{lang | {{#if:{{{lang|}}} | AND T.language = '{{{lang}}}' }} | ||
|fields = | |fields = | ||
<!-- filename --> | |||
{{#switch: {{{filename|}}} | {{#switch: {{{filename|}}} | ||
|=CONCAT(E.target_id, "{{{suffix|.png}}}")=filename, <!-- automatic behavior --> | |=CONCAT(E.target_id, "{{{suffix|.png}}}")=filename, <!-- automatic behavior --> | ||
| Line 33: | Line 21: | ||
|#default=CONCAT("{{{filename}}}")=filename, <!-- overridden filename --> | |#default=CONCAT("{{{filename}}}")=filename, <!-- overridden filename --> | ||
}} | }} | ||
<!-- link --> | |||
{{#switch: {{{link| | {{#switch: {{{link|}}} | ||
| | |=E.name=link, <!-- automatic behavior --> | ||
|=<!-- intentionally empty parameter, omit the link --> | |0=<!-- intentionally empty parameter, omit the link --> | ||
|#default=CONCAT("{{{link}}}")=link, <!-- overridden link --> | |#default=CONCAT("{{{link}}}")=link, <!-- overridden link --> | ||
}} | }} | ||
<!-- text --> | |||
{{#switch: {{{text| | {{#switch: {{{text|}}} | ||
| | |=T.name=text, <!-- automatic behavior --> | ||
|=<!-- intentionally empty parameter, omit the name --> | |0=<!-- intentionally empty parameter, omit the name --> | ||
|#default=CONCAT("{{{text}}}")=text, <!-- overridden name --> | |#default=CONCAT("{{{text}}}")=text, <!-- overridden name --> | ||
}} | }} | ||
T.language = lang, | T.language = lang, | ||
{{#if:{{{size|}}} | CONCAT("{{{size}}}") = size }} | {{#if:{{{size|}}} | CONCAT("{{{size}}}") = size }} | ||
Revision as of 12:45, 26 June 2026
This template is meant to handle the linking of articles in a way that is language-agnostic, meaning that it can be used in language-aware infoboxes and other contexts which need to be able to handle multiple languages. This template only works with concepts which have their translation managed by Cargo.
The default assumption for the icon's filename is that it is identical to the id, plus the .png extension. This can be further configured with the suffix parameter, or be completely overridden by the filename parameter.
Usage
1. Basic (rarely used, as you usually need to specify type and suffix):
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
2. With type:
Input: {{Sandbox/Aurelain/LinkIcon | id=skill_assault | type=skill}}
Output: 1=no1,id=skill_assault,lang=nolang,type=skill,filename=nofilename
Adresse
3. With suffix, to override the default (.png):
Input: {{Sandbox/Aurelain/LinkIcon | id=angel | suffix=_icon.png}}
Output: 1=no1,id=angel,lang=nolang,type=notype,filename=nofilename
Anděl
4. With lang, to override the default (en):
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon || lang=ja}}
Output: 1=,id=magic_demon,lang=ja,type=notype,filename=nofilename
ヘラルド
5. With size, to override the default (32px):
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | size=64px}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
6. With filename, to override the automated file path:
Input: {{Sandbox/Aurelain/LinkIcon | id=human_hero_1 | type=hero | filename=Ister.png}}
Output: 1=no1,id=human_hero_1,lang=nolang,type=hero,filename=Ister.png
イスター
7. With empty filename, to disable the icon:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | filename=}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=
Araldo
8. With text, to override the automated text:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=Hello}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Hello
9. With empty text, to disable the text:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | text=}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
10. With link, to override the automated link:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=Heroes}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
11. With empty link, to disable the link:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | link=}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
12. With color:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | color=magenta}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo
13. With stack=1, to switch to a vertical layout:
Input: {{Sandbox/Aurelain/LinkIcon | id=magic_demon | stack=1}}
Output: 1=no1,id=magic_demon,lang=nolang,type=notype,filename=nofilename
Araldo


