Lua:translate
Jump to navigation
Jump to search
<> Reference
function translate(string) : string
Returns a translation of the given string.
If no translation can be found, this function returns the original string unchanged.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| string | String | The string to translate. |
Returns
string — The translated string, or the original string if no translation could be found.
Examples
1 local text = translate("Health")
2
3 print(text)
1 local originalText = "Mana"
2 local translatedText = translate(originalText)
3
4 if translatedText == originalText then
5 print("No translation found")
6 else
7 print("Translation: " .. translatedText)
8 end
See Also
Main Pages
String and Encoding Related Lua Functions
Translation and Encoding
String Memory Access
Byte Table Conversions