Simutrans-Squirrel-API OTRP v63_4
Loading...
Searching...
No Matches
ttext Class Reference

#include <api_base.h>

Inheritance diagram for ttext:

Public Member Functions

 ttext (string text)
string to_string ()

Detailed Description

Translatable text.

Class takes raw string. It can do variable substitution.

When transferred to simutrans:

  1. the translation of the string will be fetched
  2. variables will be substituted

Translated strings will be taken from tab-files inside the scenario_name/ directory.

Usage:

local text = ttext("You have {N} trains running.")
text.N = 20;
// if returned to simutrans, the output will be "You have 20 trains running."
ttext(string text)

Definition at line 20 of file api_base.h.

Constructor & Destructor Documentation

◆ ttext()

ttext::ttext ( string text)

Constructor.

Parameters
textraw string to be translated.

Member Function Documentation

◆ to_string()

string ttext::to_string ( )

Does translation and variable substitution.

Returns
Translated string with all variables replaced by their values.

The documentation for this class was generated from the following file: