Dev » Lua API » loca
← Back to all classes

loca

Localization 4 Methods

loca Module

The loca static module provides access to the Stranded III internationalization (I18N) dictionary for translation key resolution and placeholder replacement.

Overview

Methods (4)

Method Signature Returns Summary
loca.tl(key) string Translates a localization key into the active language.
loca.tl1(key, v1) string Translates a key with 1 replacement parameter.
loca.tl2(key, v1, v2) string Translates a key with 2 replacement parameters.
loca.tl3(key, v1, v2, v3) string Translates a key with 3 replacement parameters.

Detailed Reference

# tl METHOD
loca.tl(key)
Translates a localization key into the active language.
Parameters
ParameterTypeDefaultDescription
keystring

Localization dictionary key.

Returns
string

Translated string in current language.

Description

Looks up key in the localization table.

local text = loca.tl("msg_game_saved")
# tl1 METHOD
loca.tl1(key, v1)
Translates a key with 1 replacement parameter.
Parameters
ParameterTypeDefaultDescription
keystring

Localization key containing {0}.

v1any

First parameter value.

Returns
string

Formatted translated string.

Description

Replaces {0} placeholder with v1.

# tl2 METHOD
loca.tl2(key, v1, v2)
Translates a key with 2 replacement parameters.
Parameters
ParameterTypeDefaultDescription
keystring

Localization key containing {0} and {1}.

v1any

First value.

v2any

Second value.

Returns
string

Formatted translated string.

Description

Replaces {0} and {1} placeholders with v1 and v2.

# tl3 METHOD
loca.tl3(key, v1, v2, v3)
Translates a key with 3 replacement parameters.
Parameters
ParameterTypeDefaultDescription
keystring

Localization key containing {0}, {1}, and {2}.

v1any

First value.

v2any

Second value.

v3any

Third value.

Returns
string

Formatted translated string.

Description

Replaces {0}, {1}, and {2} placeholders with arguments.