“Template:Season”的版本间的差异

来自Stardew Valley Wiki
跳到导航 跳到搜索
(sync with english template)
第1行: 第1行:
<includeonly><span style="display:inline; margin-right:0;">{{#switch: {{lc:{{{1}}}}}
+
<includeonly><!--
| spring | 春季  = [[File:Spring.png|{{{width|24px}}}|link= 春季]]&nbsp;[[春季]]
+
 
| summer | 夏季  = [[File:Summer.png|{{{width|24px}}}|link=夏季]]&nbsp;[[夏季]]
+
// Define the allowed values, with handling for various quirks/oddities.
| fall |  秋季  = [[File:Fall.png|{{{width|24px}}}|link= 秋季]]&nbsp;[[秋季]]
+
//  First column=icon name -> same in all languages
| winter | 冬季  = [[File:Winter.png|{{{width|24px}}}|link=冬季]]&nbsp;[[冬季]]
+
//  Second column=link (wiki page) name, generally same as displayed text -> needs translation
| marriage | 婚后 = [[File:Mermaid's Pendant.png|{{{width|24px}}}|link=婚姻]]&nbsp;[[婚姻| 婚后]]
+
//  All other values are synonyms
| deviations | 偏差 = 调整
+
// Marriage, Deviations are for sake of NPC schedule sections (and translations)
| any | all | 所有 | 所有季节 = [[File:All_Seasons_Icon.png|{{{width|24px}}}|link= 季节]]&nbsp;[[ 季节| 所有季节]]
+
// For 'All Seasons' case, display text doesn't match icon or wiki-link, so
|{{{1|}}}}}</span></includeonly><noinclude>{{englishdoc}}</noinclude>
+
// define default display text in $lang_allseasons, with parameter allowing any other preferred value
 +
-->{{ParseInputValues|code=season||
 +
,All Seasons Icon,  季节, Seasons, All, All Seasons, Any, Always, Any Season, 所有, 所有季节, 四季皆宜,
 +
,Spring,       春季,
 +
,Summer,       夏季,
 +
,Fall,        秋季, Autumn, 
 +
,Winter,       冬季,
 +
,Mermaid's Pendant, 婚后, Marriage,婚姻, 
 +
,Deviations,     调整, 偏差,
 +
}}{{#arraydefine:$lang_allseasons | 所有 }}<!--
 +
 
 +
// END OF translated text
 +
 
 +
// Check whether there's already a file link in {{{1}}}... implying this is probably a recursive call.  Return immediately
 +
-->{{#if:{{#pos:{{{1|}}}|{{Bracket|2}}File}}|{{{1}}}|<!--
 +
// Parse input data, then loop over all extracted entries
 +
-->{{#arraydefine:$sseason|{{ParseInputValues|{{{1|}}}|code=season|default=true}}}}<!--
 +
-->{{#arrayprint:$sseason||@season@|<!--
 +
 
 +
// Convert @season@ (icon name) into translated page name
 +
-->{{#arraydefine:$slink_text|{{ParseInputValues|code=season|@season@|translate=true}}}}<!--
 +
 
 +
// On first entry, add sort-key if requested. On other entries, add space and bullet.
 +
-->{{#ifexpr:{{#arraysearch:$sseason|@season@}}>0
 +
   |&#32;•&#32;
 +
   |{{#if:{{{sortkey|}}}|
 +
     <span class="sortkey" style="display:none;">{{#if:{{#arrayprint:$slink_text}}
 +
  |{{#expr:{{ParseInputValues|code=season|@season@|translate=index}}+1}}
 +
  |0}}</span>
 +
  }}}}<span style="display:inline; margin-right:0; white-space: nowrap"><!--
 +
 
 +
// Display the non-icon, non-linkable cases: Deviations, and unmatched text (detected by empty link_text)
 +
// This is also where text_only option is handled
 +
-->{{#ifeq:{{#arrayprint:$slink_text}}|
 +
   | {{ucfirst:@season@}}
 +
   | {{#ifexpr: {{#ifeq:@season@|Deviations|1|0}} or {{#if:{{{text_only|}}}|1|0}}
 +
     | {{#if:{{{no_translate|}}}
 +
   |{{#ifeq:@season@|All Seasons Icon|All|@season@}}
 +
   |{{#ifeq:@season@|All Seasons Icon|{{#arrayprint:$lang_allseasons}}|{{#arrayprint:$slink_text}}}}}}
 +
|<!--
 +
 
 +
// Display the normal cases: first display icon
 +
-->[[File:@season@.png|
 +
   {{#if:{{{size|}}}|{{{size}}}px|{{{width|24px}}}}} | link={{#arrayprint:$slink_text}} | alt=]]&nbsp;<!--
 +
// Add day if provided
 +
-->{{#if:{{{2|}}}|{{{2}}}&nbsp;}}<!--
 +
 
 +
// Add link, with special treatment for text of All Seasons
 +
-->[[{{#arrayprint:$slink_text}}|<!--
 +
-->{{#ifeq:@season@|All Seasons Icon
 +
    |{{#if:{{{all|}}}|{{{all|}}}|{{#arrayprint:$lang_allseasons}}}}
 +
    |{{#arrayprint:$slink_text}}}}]]<!--
 +
-->}}}}</span>}}}}</includeonly><noinclude>{{Englishdoc}}{{#ifexist:{{FULLPAGENAME}}/doc |<nowiki/>
 +
{{{{FULLPAGENAME}}/doc}} }}</noinclude>

2020年10月3日 (六) 18:40的版本

有关此模板的详细信息,请参阅英语语言文档页

用法

可以通过在相关页面上输入以下内容来使用此模板。

{{Season}}

结果是... Template:ParseInputValues[[File:Template:ParseInputValues.png|

    24px | link=Template:ParseInputValues | alt=]] [[Template:ParseInputValues|Template:ParseInputValues]]