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

From Kerbal Space Program Wiki
Jump to: navigation, search
(Created page with "{{Stub}} == Data templates == Templates with most of it data which doesn't need to be translated can use a special system of storing the values in another template itself. Th...")
 
m (*readded usage of Tl (don't know why I didn't); +/Param is NOT like /Box.)
 
(12 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
== Data templates ==
 
== Data templates ==
Templates with most of it data which doesn't need to be translated can use a special system of storing the values in another template itself. This helps other languages to reuse these values directly and is used by all celestial objects with {{Tl|Planetbox}}. Because every article can be included via templates it is possible to add an article other articles. Templates which are in the [[:Category:Translating Templates]] could be used for this method. It uses a subpage of the article in which the content/values are stored and the article with all the translation then imports this subpage.
 
  
For example he <nowiki>{{Planetbox}}</nowiki> template suggests to use <tt>/Data</tt> subpage which only holds the template contents which is then imported. So there is a [[Kerbol/Data]] article which only has the planet box values and [[Kerbol]] (also the different languages like [[Kerbol/sv]] or [[Kerbol/de]]) then imports this with <nowiki>{{:Duna/Data}}</nowiki>. The colon before the article's name is important, as without it, it would assume a template (<nowiki>{{Duna/Data}}</nowiki> would import <tt>Template:Duna/Data</tt>) and this would separate the specific values form the article.
+
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 {{Tl|Data template used}}, which will categorize them in [[:Category:Translating templates]].
  
If a template support this feature, it should use {{Tl|Data Template}} which automatically categorise the article and add a little help for all the users.
+
=== 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 <code><nowiki>{{:Rockomax 48-7S/Box}}</nowiki></code>. Mind the colon (":").
 +
 
 +
[[Rockomax 48-7S/Box]] itself includes {{Tl|Infobox/Part}}, which defines how the infobox is to be drawn and how to translate it.
 +
 
 +
=== Data template for celestial bodies ===
 +
 
 +
Similarly, [[Kerbin]] (English), [[Kerbin/fr]] (French) and [[Kerbin/de]] (German) all use data from [[Kerbin/Param]]. A small difference from data templates for parts is that {{Tl|Infobox/Body}} is directly included in the body's page and will automatically retrieve data from ''Kerbin/Param''. Also ''Kerbin/Param'' does not contain the infobox itself.

Latest revision as of 18:41, 26 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 (English), Kerbin/fr (French) and Kerbin/de (German) all use data from Kerbin/Param. A small difference from data templates for parts is that {{Infobox/Body}} is directly included in the body's page and will automatically retrieve data from Kerbin/Param. Also Kerbin/Param does not contain the infobox itself.