InformationModel.LookupTranslation(localizedText, localeIds)
最初の引数の
NamespaceIndex
と TextId
プロパティに基づいて、キーと関連付けられた翻訳を読み取ります。LocalizedText
オブジェクトの LocaleId
と Text
プロパティを返します。LocalizedText LookupTranslation(LocalizedTextlocalizedText, List<string>localeIds);
引数
- localizedText(LocalizedText)
- TextIdとNamespaceIndexプロパティが対象のキーを識別する C# オブジェクト。
- localeIds(List)
- ロケール ID で表される目的のロケール。最初の ID に続く ID は、フォールバック ロケールを示します。
戻り値
- LocalizedText
- localeIds引数に示されているロケールの中で使用可能な最初のロケールに基づいて値が割り当てられる C# オブジェクトのLocaleIdとTextプロパティ。ヒント: 指定されたロケールの文字列が使用できない場合、LocaleIdとTextプロパティは空のままです。
例
次の例は、
translation
の LocalizedText
キーを表す Key2
タイプの LocalizationDictionary
オブジェクトを返す API を示しています。最初の API 引数は、引数で TextId
プロパティを定義するコンストラクタを使って作成された LocalizedText
オブジェクトです。第 2 引数は、目的のロケール (it-IT
と es-ES
) の ID を含む一覧です。translation
オブジェクトは、it-IT
と es-ES
の間の最初の使用可能な変換に基づいてラベルのテキストを設定するために使用されます。var myLocalizedText = new LocalizedText("Key2"); var translation = InformationModel.LookupTranslation(myLocalizedText, new List<string>() { "it-IT", "es-ES" }); var label2 = Owner.Get<Label>("Label2"); label2.Text = "Translation: " + translation.Text;
ご質問やご意見