InformationModel.LookupTranslation(localizedText)
Reads the translations associated with a key based on the NamespaceIndex
and TextId
properties of the argument.
LocaleId
and Text
properties of a LocalizedText
object that are assigned a value based on the session locale.
LocalizedText LookupTranslation(LocalizedText localizedText);
Arguments
localizedText
(LocalizedText)- A C# object that
TextId
andNamespaceIndex
properties identify the key of interest.
Returns
LocalizedText
- A C# object that
Text
andLocaleId
properties are assigned a value based on the key provided and based on the session locale.
Example
The following example shows an API that returns a translation
object of the LocalizedText
type that contains the requested translated string, associated with the Key1
key. The API argument is a LocalizedText
object created using a constructor which argument defines its TextId
property.
The translation
object is used to set the label1
text of a label based on the session locale.
var myLocalizedText = new LocalizedText("Key1");
var translation = InformationModel.LookupTranslation(myLocalizedText);
var label1 = Owner.Get<Label>("Label1");
label1.Text = "Translation: " + translation.Text;