Template:GameText

来自Terraria Wiki
跳转到导航 跳转到搜索
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
此模板使用了 Lua。
此模板使用了用 Lua 编程语言编写的 模块:GameText。要了解 Lua 的更多信息,参见 en:Terraria Wiki:Lua
Template-info.svg 文档 以下文档来自Template:GameText/doc。(编辑 | 历史

This template is used to display text used in Terraria, exactly as in-game. Since the data is taken directly from the source code, the template facilitates automatic updates when a new patch is released. Therefore, it is the preferred choice when displaying game interface text in wiki articles.

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> | ... }}

First unnamed parameter

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

To find the index key for a specific text, visit Template:GameText/table and use your browser's search function to locate the text. Note that some texts use placeholder values like {PlayerName}, so you can try to reduce your search if it doesn't succeed.

lang

Language code, defaults to {{lang}}. Currently, there are 9 languages, as in-game: German (de)、English (en)、Spanish (es)、French (fr)、Italian (it)、Polish (pl)、Portuguese (pt)、Russian (ru)、和Chinese (zh). 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.

Notes

  • You can use {{#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|<key>}} is roughly equal to <span class="gameText">{{nl2br| {{#invoke:GameText|getRaw|<key>}} }}</span>, except that the latter will trim leading/trailing spaces.

Examples

Code Result
{{gameText|ItemName.IronPickaxe}} Iron Pickaxe
{{gameText|LegacyMultiplayer.21}} /players
x{{gameText|LegacyMenu.108}}x xZoom In x
{{gameText|ItemTooltip.BeeKeeper}} Summons killer bees after striking your foe
Small chance to cause confusion
{{gameText|UI.WorldSizeFormat}} {0} World
{{gameText|UI.WorldSizeFormat|x_0=Large}} Large World
{{gameText|UI.LightMode_Color}} Lighting: Color
{{gameText|LegacyDialog.19}} {PlayerName} is it? I've heard good things, friend!
{{gameText|LegacyDialog.19|x_PlayerName=myName}} myName is it? I've heard good things, friend!
{{gameText|Misc.ResolutionChanged}} Resolution changed to: {0}x{1}.
{{gameText|Misc.ResolutionChanged|x_1=768}} Resolution changed to: {0}x768.
{{gameText|Misc.ResolutionChanged|x_0=1024|x_1=768}} Resolution changed to: 1024x768.
{{gameText|ItemTooltip.GoodieBag}} <right> to open
{{gameText|ItemTooltip.GoodieBag|y_right=Right click}} Right click to open
{{gameText|ItemTooltip.GoodieBag|y_right={{key|open}}}} Open / Activate to open
{{gameText|ItemName.IronPickaxe|lang=es}} Pico de hierro
{{gameText|ItemName.IronPickaxe|lang=it}} Piccone di ferro
{{gameText|ItemName.IronPickaxe|lang=de}} Eisenspitzhacke
{{gameText|ItemName.IronPickaxe|lang=ru}} Железная кирка

Data storage

The data is stored in Lua databases, with each language in its own module. The databases are cached in order to improve performance. After changing a database, its cache may need to be cleared.

Language Database Links
Flag de.svg German Module:GameText/db-de clear cache
see loader module
Flag us.svg English Module:GameText/db-en clear cache
see loader module
Flag es.svg Spanish Module:GameText/db-es clear cache
see loader module
Flag fr.svg French Module:GameText/db-fr clear cache
see loader module
Flag it.svg Italian Module:GameText/db-it clear cache
see loader module
Flag pl.svg Polish Module:GameText/db-pl clear cache
see loader module
Flag pt.svg Portuguese Module:GameText/db-pt clear cache
see loader module
Flag ru.svg Russian Module:GameText/db-ru clear cache
see loader module
Flag ua.svg Ukrainian Module:GameText/db-uk clear cache
see loader module
Flag cn.svg Chinese Module:GameText/db-zh clear cache
see loader module