Back to Devexpress

CaptionHelper.GetLocalizedText(String, String) Method

expressappframework-devexpress-dot-expressapp-dot-utils-dot-captionhelper-dot-getlocalizedtext-x28-system-dot-string-system-dot-string-x29.md

latest4.4 KB
Original Source

CaptionHelper.GetLocalizedText(String, String) Method

Returns the value of a specified LocalizationItem.

Namespace : DevExpress.ExpressApp.Utils

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public static string GetLocalizedText(
    string groupPath,
    string itemName
)
vb
Public Shared Function GetLocalizedText(
    groupPath As String,
    itemName As String
) As String

Parameters

NameTypeDescription
groupPathString

A string representing the group path to the LocalizationGroup containing the specified localization item.

| | itemName | String |

A string holding the IModelLocalizationItemBase.Name of the required LocalizationItem node.

|

Returns

TypeDescription
String

The IModelLocalizationItem.Value of the specified localization item.

|

Remarks

The Application Model has the Localization node, which allows localization of various constants. The Localization node is used to localize custom strings used in an XAF application. The node contains LocalizationGroup child nodes. Each LocalizationGroup child node contains a set of LocalizationItem child nodes. The GetLocalizedText method allows you to retrieve the value of particular LocalizationItem.

Each child LocalizationGroup node of the Localization node has a group path associated with it. This path is represented by a sequence of parent localization group names separated by a double backslash. Suppose, for example, that the Localization node has the Messages localization group, which in turn has the Custom child localization group. In this instance, the group path for the Custom group is “Messages\Custom”.

To see an example of localizing custom string constants, refer to the How to: Localize Custom String Constants help topic.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetLocalizedText(String, String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-how-to-save-the-currently-opened-view-as-a-new-view-variant-at-runtime/CS/EF/ViewVariantSaveEF/ViewVariantSaveEF.Module/Controllers/UserViewVariantsController.cs#L108

csharp
parameter.Caption = string.Format("{0}_{1:g}", View.Caption, DateTime.Now);
    viewCaption = CaptionHelper.GetLocalizedText("Texts", "NewViewVariantParameterCaption");
}

See Also

Localization Basics

CaptionHelper Class

CaptionHelper Members

DevExpress.ExpressApp.Utils Namespace