Sablon:GameText/doc

Innen: Terraria Wiki
Ugrás a navigációhoz Ugrás a kereséshez

This template is used to retrieve in-game text, based on the game text database which is taken from the source code.

Note: This template is relatively slow, so please use other database templates first, if possible.

Usage

{{ gameText | <index key> | lang = <lang> | x_<name> = <value> | ... | y_<name> = <value> | ... | keepnl = y/yes | json = y/yes }}

First unnamed parameter

The index key for the text. It is the same as in the in-game language JSON files. See examples below.

lang

Language code, defaults to {{lang}}. Currently, there are nine languages, as in-game: English (en), Spanish (es), Italian (it), Chinese (zh), German (de), Russian (ru), French (fr), Polish (pl), and Portuguese (pt). All other languages will use the English database.

All x_<name> and y_<name> parameters

Replacement for placeholders. There are two types of placeholder in the game texts: {xxx} and <yyy>, indexed by x_... and y_..., respectively. See examples below.

json

By default, the template will fetch its data from the cargo database. If this parameter is set, it will query from the original game language files, stored as JSON in Lua modules. This is a bit more stable and accurate and supports returning all contents of a string array, at the cost of taking up much more resources.

Notes

  • You can use {{[[Sablon:#invoke:gameText |#invoke:gameText ]]| getRaw| {{{key|}}}}} to get a raw string from the GameText info database. It also takes lang and replacement arguments. This is mainly for use in other templates.
  • {{gameText}} will keep leading/trailing spaces.
  • {{gameText}} is roughly equal to <span class="gameText">{{nl2br| {{#invoke:gameText | getRaw |{{{key|}}}}} }}</span>, except for the latter will trim leading/trailing spaces.

Examples

Code Result
{{gameText|ItemName.IronPickaxe}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Iron Pickaxe)
{{gameText|LegacyMultiplayer.21}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: /players)
x{{gameText|LegacyMenu.108}}x xLua-hiba: Error: Table GameText not found..x FAIL! (expected: xZoom In x)
{{gameText|ItemTooltip.BeeKeeper}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Summons killer bees after striking your foe
Small chance to cause confusion
)
{{gameText|UI.WorldSizeFormat}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: {0} World)
{{gameText|UI.WorldSizeFormat|x_0=Large}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Large World)
{{gameText|UI.LightMode_Color}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Lighting: Color)
{{gameText|LegacyDialog.19}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: {PlayerName} is it? I've heard good things, friend!)
{{gameText|LegacyDialog.19|x_PlayerName=myName}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: myName is it? I've heard good things, friend!)
{{gameText|Misc.ResolutionChanged}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Resolution changed to: {0}x{1}.)
{{gameText|Misc.ResolutionChanged|x_1=768}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Resolution changed to: {0}x768.)
{{gameText|Misc.ResolutionChanged|x_0=1024|x_1=768}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Resolution changed to: 1024x768.)
{{gameText|ItemTooltip.GoodieBag}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: <right> to open)
{{gameText|ItemTooltip.GoodieBag|y_right=Right click}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Right click to open)
{{gameText|ItemTooltip.GoodieBag|y_right={{key|open}}}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Kinyitás/Bekapcsolás to open)
{{gameText|ItemName.IronPickaxe|lang=es}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Pico de hierro)
{{gameText|ItemName.IronPickaxe|lang=it}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Piccone di ferro)
{{gameText|ItemName.IronPickaxe|lang=de}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Eisenspitzhacke)
{{gameText|ItemName.IronPickaxe|lang=ru}} Lua-hiba: Error: Table GameText not found.. FAIL! (expected: Железная кирка)
{{[[Sablon:#lstsep:{{gameText|TownNPCHousingFailureReasons|json=y}}|₪|<br/>|#lstsep:{{gameText|TownNPCHousingFailureReasons|json=y}}|₪|<br/>]]}} Ez a szoba túl nagy
Ez a szoba túl kicsi
Túl közel van a világ széléhez!
Ebből a szobából hiányzik a fal
Ez egy szilárd kocka!

Data storage

Cargo

The cargo database is queried if $json is not true, i.e., by default. The following pages are used to store the data to the cargo database:

Lua (JSON)

The Lua database is queried if $json is true. It is comprised of the following modules: