Calendar: Localization

1. Culture

DayPilot will adjust its appearance automatically depending on the Culture set for the current thread.

The Culture can be set in one of the following places:

1. In web.config, configuration/system.web/globalization element, culture attribute.

<configuration>
    <system.web>
        <globalization culture="en-US"/>
    </system.web>
</configuration>

2. In aspx page header:

<%@ Page Culture="en-US" %>

3. In the code behind:

 protected void Page_Load(object sender, EventArgs e)
 {
    Culture = new CultureInfo("da-DK");
 }

2. Adjusting individual properties

Individual aspects of the locale can be adjusted separately using the following properties:

  • TimeFormat
  • HeaderDateFormat
  • WeekStarts
  • LoadingLabelText

3. TimeFormat

TimeFormat determines the hour name format in the row headers (12-hour clock or 24-hour clock).

The default value is Auto. It means the value will be detected using the Culture.

4. HeaderDateFormat

This property determines the format of the date in day (column) headers. It accepts the same values as DateTime.ToString(string) method.

The default value is "d" which will use the default format set for the current Culture.

See also: http://www.daypilot.org/choosing_headerdateformat_datetime_tostring_parameters.html

5. WeekStarts

This property determines the first day of week. It is only used for ViewType="Week".

The default value is Auto. This means the value will be detected using current Culture.

6. LoadingLabelText

The only text that needs to be localized. This is a label that appears in the upper-left corner when callback loading takes more than 100 ms.

The default value is "Loading...".

It's only visible for LoadingLabelVisible="true".

7. Date and time in the event text

By default, event start and end time is added to the event text.

It uses DateTime.ToShortDateString() and DateTime.ToShortTimeString() methods (they are using the current culture to format the date and time).

The event text can be fully customized using BeforeEventRender event handler (by changing e.InnerHTML property).

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java