Template:Translate/doc: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
m how to help translate
Sur (talk | contribs)
mNo edit summary
Line 23: Line 23:


=Example=
=Example=
Without providing lang_override, the language will be detected based on the subpage the user is on, i.e. /Abrams/es will be detected as a spanish page.
<pre style="width: fit-content">{{Translate|Patch notes}}</pre>
<pre style="width: fit-content">{{Translate|Patch notes}}</pre>


Line 35: Line 36:


{{Translate|Patch notes|ru}}
{{Translate|Patch notes|ru}}
If translation to that language does not yet exist, it will default to the english translation, and add <code><nowiki>{{NeedsTranslation}}</nowiki></code> at the end.
<pre style="width: fit-content">{{Translate|Patch notes|zh}}</pre>
Outputs
{{Translate|Patch notes|zh}}


=Parameters=
=Parameters=

Revision as of 01:09, 9 October 2024

How to help translate

Navigate to Data:Dictionary and add the translations for a specific key there. For example, to translate 'Patch notes' to spanish (es), edit the record in the Dictionary from

"Patch notes": {
		"en": "Patch notes",
		"ru": "Содержание обновления"
	}

to

"Patch notes": {
		"en": "Patch notes",
		"ru": "Содержание обновления",
		"es": "Notas de revision"
	}


Similarly, if translating a new key not yet added, simply add the record that looks like the above at the bottom of the page, but be sure the last curly brace } has a comma afterwards.

Example

Without providing lang_override, the language will be detected based on the subpage the user is on, i.e. /Abrams/es will be detected as a spanish page.

{{Translate|Patch notes}}

Outputs

Patch notes


{{Translate|Patch notes|ru}}

Outputs

Содержание обновления


If translation to that language does not yet exist, it will default to the english translation, and add {{NeedsTranslation}} at the end.

{{Translate|Patch notes|zh}}

Outputs

Patch notes[nt]

Parameters

A template to fetch translations for a given key, optionally overriding the language.

Template parameters

ParameterDescriptionTypeStatus
key_to_translate1

The key that corresponds to the text to be translated.

Example
Patch notes
Stringrequired
lang_override2

Optional two-letter language code to override the language (e.g., 'en', 'es'), if page ends in /<lang_code> it defaults to that lang code.

Default
Example
es
Stringoptional