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
local text = translate("Health")
print(text)
local originalText = "Mana"
local translatedText = translate(originalText)
if translatedText == originalText then
print("No translation found")
else
print("Translation: " .. translatedText)
end
See Also
Main Pages