Difference between revisions of "Kerbal Space Program Wiki:Templates"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Fixed more outdated information)
(Highlighted inconsistency of data templates)
Line 7: Line 7:
 
=== Data templates for parts ===
 
=== Data templates for parts ===
  
For instance, [[Rockomax 48-7S]] (English), [[Rockomax 48-7S/pl]] (Polish) and [[Rockomax 48-7S/ja]] (Japanese) all use the same raw data stored in the data template [[Rockomax 48-7S/Box]] to draw the infobox on the right. To do so, they simply include the following line (mind the colon (":")):
+
For instance, [[Rockomax 48-7S]] (English), [[Rockomax 48-7S/pl]] (Polish) and [[Rockomax 48-7S/ja]] (Japanese) all use the same raw data stored in the data template [[Rockomax 48-7S/Box]] to draw the infobox on the right. To do so, they simply include <code><nowiki>{{:Rockomax 48-7S/Box}}</nowiki></code>. Mind the colon (":").
 
 
<code><nowiki>{{:Rockomax 48-7S/Box}}</nowiki></code>
 
  
 
[[Rockomax 48-7S/Box]] itself includes {{Tl|Infobox/Part}}, which defines how the infobox is to be drawn and how to translate it.
 
[[Rockomax 48-7S/Box]] itself includes {{Tl|Infobox/Part}}, which defines how the infobox is to be drawn and how to translate it.
Line 15: Line 13:
 
=== Data template for celestial bodies ===
 
=== Data template for celestial bodies ===
  
Similarly, [[Kerbin]] (English), [[Kerbin/fr]] (French), [[Kerbin/de]] (German) all use data from [[Kerbin/Param]]. Here, {{Tl|Infobox/Body}} is put directly in [[Kerbin]] and finds [[Kerbin/Param]] by itself.
+
Similarly, [[Kerbin/fr]] (French) and [[Kerbin/de]] (German) both use data from [[Kerbin/Data]] by simply including <nowiki>{{:Kerbin/Data}}</nowiki>.
 +
 
 +
For some reason, [[Kerbin]] (English) proceeds differently. Here, {{Tl|Infobox/Body}} is put directly in [[Kerbin]] and finds [[Kerbin/Param]] (duplicate of Kerbin/Data) by itself.

Revision as of 18:16, 24 December 2014

This article is a stub. You can help KSP Wiki by expanding it.

Data templates

Language-independent information should be stored in a specific template (a “data template“), to be referred to by each localized template (e.g. English, French, etc). This avoids duplicating data in different pages and improves maintainability and stability. Such templates should use {{Data template used}}, which will categorize them in Category:Translating templates.

Data templates for parts

For instance, Rockomax 48-7S (English), Rockomax 48-7S/pl (Polish) and Rockomax 48-7S/ja (Japanese) all use the same raw data stored in the data template Rockomax 48-7S/Box to draw the infobox on the right. To do so, they simply include {{:Rockomax 48-7S/Box}}. Mind the colon (":").

Rockomax 48-7S/Box itself includes {{Infobox/Part}}, which defines how the infobox is to be drawn and how to translate it.

Data template for celestial bodies

Similarly, Kerbin/fr (French) and Kerbin/de (German) both use data from Kerbin/Data by simply including {{:Kerbin/Data}}.

For some reason, Kerbin (English) proceeds differently. Here, {{Infobox/Body}} is put directly in Kerbin and finds Kerbin/Param (duplicate of Kerbin/Data) by itself.