Editing Template:Lang/docGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
Template for retrieving localized strings from their relevant json file, such as '''Data:Lang_en.json''' for English. Note that localized strings are all pulled from raw game files. | |||
Supports retrieval via the JSON '''key''' or by referencing it using the English '''label''' | |||
=== Examples === | === Examples === | ||
==== Retrieve word by key ==== | ==== Retrieve word by the attribute key ==== | ||
English string: | <pre>English string: {{Lang|key=BonusClipSize_label}} -> "Ammo"</pre> | ||
<pre>French string: {{Lang|key=BonusClipSize_label|lang_code=fr}} -> "Munitions"</pre> | |||
==== Retrieve string by label ==== | ==== Retrieve string by label ==== | ||
English string: | <pre>English string: {{Lang|label=Ammo}} -> "Ammo"</pre> | ||
<pre>French string: {{Lang|label=Ammo|lang_code=fr}} -> "Munitions"</pre> | |||
<templatedata> | <templatedata> | ||
{ | { | ||
"params": { | "params": { | ||
" | "key": { | ||
"description": " | "description": "Attribute key to directly retrieve the localized string from its JSON file", | ||
"example": " | "example": "BonusClipSize_label", | ||
"type": "string" | "type": "string" | ||
}, | }, | ||
" | "lang_code": { | ||
"description": " | "description": "Two-letter language code for selecting language of string. Note that this should not usually be used, as the lang code will be pulled from the URL subpage.", | ||
"example": " | "example": "en", | ||
"type": "string", | "type": "string", | ||
" | "default": "Defaults to \"en\" (English), or if the URL has the code at the end, it will use that" | ||
}, | }, | ||
"label": { | "label": { | ||
"description": "Used to search for the string by its | "description": "Used to search for the string by its English localized string instead of using the attribute key directly", | ||
"example": "Ammo", | "example": "Ammo", | ||
"type": "string" | "type": "string" | ||
| Line 47: | Line 37: | ||
"label", | "label", | ||
"lang_code" | "lang_code" | ||
] | ] | ||
} | } | ||
</templatedata> | </templatedata> | ||
<noinclude>[[Category:Template documentation]]</noinclude> | |||