Back to Devexpress

IXafCultureInfoService Interface

expressappframework-devexpress-dot-expressapp-dot-blazor-dot-services-fe7ece5c.md

latest2.1 KB
Original Source

IXafCultureInfoService Interface

Declares members of a localization service.

Namespace : DevExpress.ExpressApp.Blazor.Services

Assembly : DevExpress.ExpressApp.Blazor.v25.2.dll

NuGet Package : DevExpress.ExpressApp.Blazor

Declaration

csharp
public interface IXafCultureInfoService
vb
Public Interface IXafCultureInfoService

Remarks

XAF features a built-in implementation of the IXafCultureInfoService interface.

Example

The code sample below demonstrates how to use IXafCultureInfoService to change the application localization.

File :
MySolution.Blazor.Server\Controllers\GermanCultureController.cs

csharp
using DevExpress.ExpressApp; 
using DevExpress.ExpressApp.Actions; 
using DevExpress.ExpressApp.Blazor; 
using DevExpress.ExpressApp.Blazor.Services; 
using DevExpress.Persistent.Base; 
// ...
public class GermanCultureController : ViewController { 
    BlazorApplication BlazorApplication => (BlazorApplication)Application; 
    IXafCultureInfoService CultureInfoService => (IXafCultureInfoService)BlazorApplication.ServiceProvider.GetService(typeof(IXafCultureInfoService)); 
    public GermanCultureController() { 
        SimpleAction myAction = new SimpleAction(this, "SetGermanCulture", PredefinedCategory.Edit); 
        myAction.Execute += async (s, e) => await CultureInfoService.SetCultureAsync("de"); 
    } 
}

See Also

IXafCultureInfoService Members

Localize an XAF Application

DevExpress.ExpressApp.Blazor.Services Namespace