Multilingual conversion||doc136010

September 20, 2022

Format

 Lang:toText(arg) 
  • The class to which the function belongs:Lang

Description

Returns the corresponding text content in the multilingual list according to the passed parameters. incomingargThe parameter can be a string type or a table type. If it is a string type, the corresponding text content will be directly indexed in the multilingual list; if it is a table type, the value of index 1 in the table will be used as the multilingual index in the The text content corresponding to the multilingual list index is spliced into the text content in turn by a special rule, so this table is an ordered table.


special splicing rules

The simplest splicing content is splicing common constants and characters, or splicing another multilingual index.

special characters

character effect
{} Splice ordinary characters
{.} The spliced characters are spliced as multilingual indexed text content


Precautions

  • If you try to index a non-existent content in a multilingual list, it will return the text content after keeping the original content and applying special rules.
  • Some special characters (such as "[", "]") can be displayed normally by adding before the character, such as: this is the [] number, the actual output: this is the [] number

Parameters

Variable name type Description
param variant A table composed of multilingual keys


Value Returned

type Description
string Multilingual characters


Code Samples

Multilingual conversion

Multilingual list

print(Lang:toText("lang_text")) --output: multilingual test

Splice ordinary characters

Multilingual list

print(Lang:toText({"lang_text", 1})) -- output: the first multilingual test

Splice other multilingual indexes

Multilingual list

print(Lang:toText({"lang_text", "text"})) -- output: multilingual test

Attempt to splice a multilingual index that does not exist

print(Lang:toText({ "lang_text", "text1" })) --Output: multilingual text1