Simutrans-Squirrel-API
Public Member Functions | List of all members
ttext Class Reference

#include <api_base.h>

Inheritance diagram for ttext:
ttextfile

Public Member Functions

string to_string ()
 
 ttext (string text)
 

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

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: