Template:Displaytext

From Calamity Mod Wiki
Jump to: navigation, search
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for Templates to learn more.
Template-info.svg Documentation The documentation below is transcluded from Template:Displaytext/doc. (edit | history)

Get display text. Used in templates with link and custom display text. For English, it will do intuitive pluralism process for plural suffixes (s/es/ies).

Usage

{{displaytext|arg1|arg2|lang=<lang>}} The result text will be auto-translated by {{tr}} (also see below).

Unnamed Parameter 1

Base text (is usually the link)

Unnamed Parameter 2 (optional)

Custom display text, or plural suffix (s/es/ies)

lang (optional)

Language code for plural process. Default is {{lang}}.

Examples

Code Result Note
{{displaytext|Block}} Block Regular
{{displaytext|Block|s}} Blocks
{{displaytext|Boss|es}} Bosses
{{displaytext|Butterfly|ies}} Butterflies
{{displaytext| Boss | es }} Bosses Spaces will be ignored.
{{displaytext|Boss|s}} Bosses Smart process for "s"
{{displaytext|Cash|s}} Cashes
{{displaytext|Watch|s}} Watches
{{displaytext|Box|s}} Boxes
{{displaytext|Butterfly|s}} Butterflies
{{displaytext|Mouse|s}} Mice
{{displaytext|Leaf|s}} Leaves
{{displaytext|Staff|s}} Staves
{{displaytext|Knife|s}} Knives
{{displaytext|Campfire|s}} Campfires
{{displaytext|Gold Table|Golden}} Golden Custom display text
{{displaytext|Draedon's Forge|s|lang=ko}} 드레이돈의 용광로 i18n support.

L10n note

This template is designed to work with auto translation, therefore, for non-English languages, it should be able to recognize English plural suffixes, and not treat them as custom text, even if they are not plural suffixes in the target language. Auto translation can be turned off in the code of the template.

For example, for English, {{displaytext|Moon Lord|s}} will output Moon Lords, while for Chinese (zh), {{displaytext|Moon Lord|s}} will/should output 月亮领主 (auto-translated) or Moon Lord (if it cannot be auto-translated) instead of s only (there is no plural form grammar in Chinese, but {{displaytext}} will recognize "s" as plural suffix and ignore it instead of displaying it as custom text).