Home Contents | # Numeric Mode | Tr | Core4 Lua Commands

## DESCRIPTION

In numeric mode, each translatable text gets a unique number. Whenever a text is needed, its number is looked up inside the translation tables.

A translation table setup could look like this:

tr[1] = { [1000] = "Please wait" [2000] = "Welcome, %1" [3000] = "Access denied" } tr[2] = { [1000] = "Please stand by" }

Whenever tr(x) is called, the value x is looked up inside the translation tables, starting with the highest index and continuing down until a match is found. Thus, in the given example, calling tr(1000) would map to "Please stand by".

An application can use this priority scheme for dynamically loaded translations, which can be wiped away when no longer needed with a simple tr[2] = nil.

Note the use of %1 in entry 2000, which can be used together with string.arg().

In addition to putting the translations right into the Lua source code, you can also load translations from CSV files using tr.load().

This mode is modelled after string resources inside WIN32 exectuables.

## SEE ALSO

tr(), tr.context, tr:installTranslator, tr.load, tr.loadTranslator, tr.translators