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

From Kerbal Space Program Wiki
Jump to: navigation, search
(Languages Supported: *synchronized with MediaWiki:Sidebar;)
(Templates)
Line 51: Line 51:
 
# A text uses {{Tl|lang}} to be translated into another language
 
# A text uses {{Tl|lang}} to be translated into another language
 
# A text uses a [[:Category:Dictionary Templates|dictionary template]] to translate a text
 
# A text uses a [[:Category:Dictionary Templates|dictionary template]] to translate a text
Most templates either use the first option (like {{Tl|Main Page Layout}}) or a combination of the second and third option (like {{Tl|Partbox}} and their subtemplates).
+
The {{Tl|Main Page Layout}} template for example uses the first option while {{Tl|Partbox}} and their subtemplates uses a combination of the second and third option. Usually there is no combination with the first option.
 +
 
 
=== Translation via parameters ===
 
=== Translation via parameters ===
This strategy is easy to understand but has the drawback, that other parameters can't be easily reused. So if the site is static and two languages normally don't use the same value for the same parameter this system works fine.
+
This strategy is easy to understand but has the drawback, that other parameters like values can't be easily reused. So if the site is static this system works fine.
  
To create a new translation a new template needs to be created which normally uses the language code as a suffix (e.g. [[Main Page/de]]). This uses now the generic template and fills in for each parameter the translation of this text.
+
To translate an article using this method a new created article with the language code as a suffix (e.g. [[Main Page/de]]) must be created. This new article uses the generic template (for [[Main Page/de]] would be {{Tl|Main Page Layout}}) and adds for each parameter the translation the text.
  
 
=== Translation via {{Tl|lang}} ===
 
=== Translation via {{Tl|lang}} ===
Another way to translate a page, is by using the template {{Tl|lang}}. This holds the translation for a text into other languages:
+
Another way to translate a page, is by using the template {{Tl|lang}}. This holds the translation for a text into other languages. To add a new translation simply add a new parameter with the language code and translation like:
<pre>{{lang
+
{|
 +
! Before adding
 +
! After adding
 +
|- valign="top"
 +
| <pre>{{lang
 
|en=[[w:Mass|Mass]]
 
|en=[[w:Mass|Mass]]
 
|nl=[[w:nl:Massa|Massa]]
 
|nl=[[w:nl:Massa|Massa]]
Line 67: Line 72:
 
|de=[[w:de:Masse (Physik)|Masse]]
 
|de=[[w:de:Masse (Physik)|Masse]]
 
}}</pre>
 
}}</pre>
To add a new translation simply add a new parameter with the language code and translation like:
+
| <pre>{{lang
<pre>{{lang
 
 
|en=[[w:Mass|Mass]]
 
|en=[[w:Mass|Mass]]
 
|nl=[[w:nl:Massa|Massa]]
 
|nl=[[w:nl:Massa|Massa]]
Line 77: Line 81:
 
|tlh=ngI'
 
|tlh=ngI'
 
}}</pre>
 
}}</pre>
This template uses the English value if there is no translation for the given language. The more advanced system uses dictionary templates.
+
|}
 +
This template uses the English value if there is no translation for the given language. The more advanced system uses dictionary templates. There are also {{Tl|LangDef}} and {{Tl|LangFallback}} which adds similar features. While <nowiki>{{LangDefault}}</nowiki> allows to add another default message than the English the <nowiki>{{LangFallback}}</nowiki> template adds a little link also to the English version of the article.
  
 
=== Translation via dictionary templates ===
 
=== Translation via dictionary templates ===
 
A dictionary template allows a template to reuse a translation. To add a new language only one template has to be edited. All dictionary templates should be sorted in the [[:Category:Dictionary Templates]] and named <tt><name of template>/Dict</tt>. As these templates usually use also {{Tl|lang}} adding a language works exactly the same, but instead directly in the template the new translation is added in the dictionary template. Using a dictionary template depends actually depends on how they work, but it should normally be <nowiki>{{<name of template>/Dict|<word to translate>}}</nowiki>.
 
A dictionary template allows a template to reuse a translation. To add a new language only one template has to be edited. All dictionary templates should be sorted in the [[:Category:Dictionary Templates]] and named <tt><name of template>/Dict</tt>. As these templates usually use also {{Tl|lang}} adding a language works exactly the same, but instead directly in the template the new translation is added in the dictionary template. Using a dictionary template depends actually depends on how they work, but it should normally be <nowiki>{{<name of template>/Dict|<word to translate>}}</nowiki>.
 +
 +
=== Using an automatically translating template ===
 +
If the template automatically translates and the values are language independent  like for the {{Tl|Planetbox}} template it is possible to do some simplifications and the values needs to be set only once but use them in all translations. This is usually done by creating a subpage which only uses the template which all other pages then include. All celestial objects use <nowiki>{{Planetbox}}</nowiki> in their <tt><name of celestial object>/Data</tt> (e.g. [[Duna/Data]]) page and then add this page into the different translations with <tt><nowiki>{{:<name of celestial object>/Data}}</nowiki></tt> (e.g. [[Duna]] or [[Duna/sv]]).

Revision as of 21:47, 30 April 2013

The Kerbal Space Program Wiki is intended to be a useful resource not just to English-speakers, but also to users who speak other languages. Therefore, we've added many different ways translators can translate pages into the desired language.

Language Subpages

KSP wiki supports language subpages in the style of Valve's Official TF2 wiki. This means that, if you wish to translate a language, you simply copy the page over to a new page with /xx at the end (xx being the two-letter language code, such as ru for Russian or es for Spanish). For example, the Russian-language Main Page is at Main Page/ru. English-language subpages do not have a suffix, as that is the default language of the wiki.

Language Page to Create
English Main Page
Russian (русский) Main Page/ru
Spanish (español) Main Page/es
Chinese (中文(中国大陆)‎) Main Page/zh-cn
Chinese (中文(台灣)‎) Main Page/zh-tw

Once the page is created, other language pages will link to it via the Languages toolbox on the sidebar. Note that some namespaces do not display any languages as a precaution.

Languages Supported

If you do not see your language here and you wish to start translating for it, please bug N3X15 (talk) so he can add it to the sidebar for you.
Code Language
(default) English
de German (Deutsch)
es Spanish (español)
fr French (français)
nl Dutch (Nederlands)
pl Polish (polski)
pt Portuguese (português)
ru Russian (русский)
sv Swedish (svenska)

Templates

Some templates support multiple languages, so the template code don't need to be duplicated for another language. There are following three options available:

  1. Each text which can be translated has a separate parameter
  2. A text uses {{lang}} to be translated into another language
  3. A text uses a dictionary template to translate a text

The {{Main Page Layout}} template for example uses the first option while {{Partbox}} and their subtemplates uses a combination of the second and third option. Usually there is no combination with the first option.

Translation via parameters

This strategy is easy to understand but has the drawback, that other parameters like values can't be easily reused. So if the site is static this system works fine.

To translate an article using this method a new created article with the language code as a suffix (e.g. Main Page/de) must be created. This new article uses the generic template (for Main Page/de would be {{Main Page Layout}}) and adds for each parameter the translation the text.

Translation via {{lang}}

Another way to translate a page, is by using the template {{lang}}. This holds the translation for a text into other languages. To add a new translation simply add a new parameter with the language code and translation like:

Before adding After adding
{{lang
|en=[[w:Mass|Mass]]
|nl=[[w:nl:Massa|Massa]]
|fr=[[w:fr:Masse|Masse]]
|pl=[[w:pl:Masa_(fizyka)|Masa]]
|ru=[[w:ru:Масса|Масса]]
|de=[[w:de:Masse (Physik)|Masse]]
}}
{{lang
|en=[[w:Mass|Mass]]
|nl=[[w:nl:Massa|Massa]]
|fr=[[w:fr:Masse|Masse]]
|pl=[[w:pl:Masa_(fizyka)|Masa]]
|ru=[[w:ru:Масса|Масса]]
|de=[[w:de:Masse (Physik)|Masse]]
|tlh=ngI'
}}

This template uses the English value if there is no translation for the given language. The more advanced system uses dictionary templates. There are also {{LangDef}} and {{LangFallback}} which adds similar features. While {{LangDefault}} allows to add another default message than the English the {{LangFallback}} template adds a little link also to the English version of the article.

Translation via dictionary templates

A dictionary template allows a template to reuse a translation. To add a new language only one template has to be edited. All dictionary templates should be sorted in the Category:Dictionary Templates and named <name of template>/Dict. As these templates usually use also {{lang}} adding a language works exactly the same, but instead directly in the template the new translation is added in the dictionary template. Using a dictionary template depends actually depends on how they work, but it should normally be {{<name of template>/Dict|<word to translate>}}.

Using an automatically translating template

If the template automatically translates and the values are language independent like for the {{Planetbox}} template it is possible to do some simplifications and the values needs to be set only once but use them in all translations. This is usually done by creating a subpage which only uses the template which all other pages then include. All celestial objects use {{Planetbox}} in their <name of celestial object>/Data (e.g. Duna/Data) page and then add this page into the different translations with {{:<name of celestial object>/Data}} (e.g. Duna or Duna/sv).