ASPxSchedulerLocalizer Class

An object providing a means to localize the ASPxScheduler's user interface elements at runtime.

Namespace: DevExpress.Web.ASPxScheduler.Localization

Assembly: DevExpress.Web.ASPxScheduler.v19.2.dll

Declaration

public class ASPxSchedulerLocalizer :
    XtraLocalizer<ASPxSchedulerStringId>
Public Class ASPxSchedulerLocalizer
    Inherits XtraLocalizer(Of ASPxSchedulerStringId)

Remarks

The ASPxScheduler allows you to localize its user interface elements at runtime. This approach can be useful, for example, if you want to set the resource value based on a run-time condition. ASPxScheduler runtime interface localization can be performed via the ASPxSchedulerLocalizer object. It provides default (en) culture resource string values and allows you to override them.

The following code demonstrates how to implement this approach.

using DevExpress.Web.ASPxScheduler.Localization;
using DevExpress.Utils.Localization.Internal;
using DevExpress.XtraScheduler.Localization;
    protected void Page_Init(object sender, EventArgs e)
    {
        MyLocalizer myLocalizer = new MyLocalizer();
        DefaultActiveLocalizerProvider<ASPxSchedulerStringId> provider = 
            new DefaultActiveLocalizerProvider<ASPxSchedulerStringId>(myLocalizer);
        ASPxSchedulerLocalizer.SetActiveLocalizerProvider(provider);
        ASPxSchedulerLocalizer.Active = myLocalizer;

        MyLocalizerCore myLocalizerCore = new MyLocalizerCore();
        DefaultActiveLocalizerProvider<SchedulerStringId> providerCore =
            new DefaultActiveLocalizerProvider<SchedulerStringId>(myLocalizerCore);
        SchedulerLocalizer.SetActiveLocalizerProvider(providerCore);
        SchedulerLocalizer.Active = myLocalizerCore;
    }
    public class MyLocalizer : DevExpress.Web.ASPxScheduler.Localization.ASPxSchedulerLocalizer
    {
        public override string GetLocalizedString(ASPxSchedulerStringId id)
        {
            string ret = "";
            switch (id)
            {
                case DevExpress.Web.ASPxScheduler.Localization.ASPxSchedulerStringId.CaptionViewNavigator_Today: 
                    return DateTime.Now.Date.ToShortDateString();
                default:
                    ret = base.GetLocalizedString(id);
                    break;
            }
            return ret;
        }
    }

    public class MyLocalizerCore : DevExpress.XtraScheduler.Localization.SchedulerLocalizer {
        public override string GetLocalizedString(DevExpress.XtraScheduler.Localization.SchedulerStringId id) {
            if (id == DevExpress.XtraScheduler.Localization.SchedulerStringId.MenuCmd_NewAppointment )
                return "New Event";

            return base.GetLocalizedString(id);
        }
    }

Inheritance

Object
XtraLocalizer<ASPxSchedulerStringId>
ASPxSchedulerLocalizer
See Also