Description
Retrieve a string in the current user interface language. Or in a specific language. Parameters after the key are substituted in order for %1, %2, etc.
Examples
[%$title = txt("title"); // "For your information", "Zu Ihrer Information"%]
[%// Replacement:
$subtitle = txt("subtitle", $something->label());%]
[%WARNING!!!
This works and will remain working, but using the lang function is better.
txt calls come usually in bulk. With the approach above you carry the
language around in the code which cloggs it and makes changes
more difficult. A call to lang avoids that and simplifies the code.
// We need a specific language, different from the negogiated language.
$lang = $someone->get_language();
$subject = txt($lang->id, "email_subject") // "Your chance", "Ihre Chance"
$body = txt(
$lang->id,
"email_body",
$someone->get_first_name(),
$someone->get_last_name(),
$someone->get_dob()->format(txt($lang->id, "date_format")
);
%]
|
Parameters2
Coding name |
key
|
Description |
The key under which the text is addressed.
|
Position |
1
|
Type |
String(Primitive type)
|
Coding name |
rest
|
Description |
The remaining arguments are used for replacing occurrences of %n in the translation of the text. With n being a natural number.
|
Position |
2
|
Type |
String(Primitive type)
|
|