XafApplication.CustomizeLanguage Event
Occurs after a language has been set for the application internally.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v25.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Event Data
The CustomizeLanguage event's data class is CustomizeLanguageEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| LanguageName | Specifies the language currently used by the application. |
| PreferredLanguageName | Specifies the language currently set for the Application Model‘s IModelApplication.PreferredLanguage property. |
| UserLanguageName | Specifies the language which is set in the user’s operating system or passed by the Internet browser. |
Remarks
Handle this event to set the required language to be used by the application. To get the language currently set, use the handler’s CustomizeLanguageEventArgs.LanguageName property. In addition, you can get the language which is set in the user’s operating system or passed by the Internet browser. For this purpose, use the handler’s CustomizeLanguageEventArgs.UserLanguageName property. To get the language which is currently set for the Application node’s IModelApplication.PreferredLanguage property, use the handler’s CustomizeLanguageEventArgs.PreferredLanguageName property. Note that the language you set in this event handler cannot be changed via the Application Model at runtime.
The following code snippet sets the default language to German:
using System;
using DevExpress.ExpressApp;
// ...
namespace MySolution.Module;
public sealed partial class MySolutionModule : ModuleBase {
// ...
public override void Setup(XafApplication application) {
base.Setup(application);
application.CustomizeLanguage += Application_CustomizeLanguage;
}
private void Application_CustomizeLanguage(object sender, CustomizeLanguageEventArgs e) {
e.LanguageName = "de";
// To use the default (English) language, use the following code line instead:
// e.LanguageName = "en"; }
// ...
}
}
Tip
Localize properties in the “de” language before you run the application with the code above. Otherwise, the default (English) language will be used.
You can use the IModelApplication.PreferredLanguage property of the Application Model’s Application node to set a language, if you do not use any conditions to determine the language the application should use.