Skip to main content

ASPxSchedulerLocalizer Class

Provides a means to localize the ASPxScheduler‘s UI elements at runtime.

Namespace: DevExpress.Web.ASPxScheduler.Localization

Assembly: DevExpress.Web.ASPxScheduler.v24.1.dll

NuGet Package: DevExpress.Web.Scheduler

Declaration

public class ASPxSchedulerLocalizer :
    XtraLocalizer<ASPxSchedulerStringId>

Remarks

Use the ASPxSchedulerLocalizer class to access default (en) culture resource string values and override them at runtime.

If you localize your application via satellite resource assemblies or global resources, use the ASPxSchedulerResLocalizer class for runtime localization. This class provides the same functionality, but contains localized resource string values.

For more information, refer to the following topic: Localizer Objects.

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

See Also