[CLOSED] ext:CalendarPanel: Today is in English format, should be in Portuguese

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] ext:CalendarPanel: Today is in English format, should be in Portuguese

    Hi

    In CalendarPanel, Today is in English format: should be in Portuguese: Hoje, 13:50. In Brazil, we use the military time format.

    See highilighted 2 on picture bellow.

    Attachment 4019
    Last edited by Daniil; Mar 28, 2012 at 1:33 PM. Reason: [CLOSED]
  2. #2
    Hi,

    It's not localized automatically as well.

    Regarding to "Today" text. There is the respective TodayText property of Views.

    Regarding to the time format. It's more complicated, needs to override the scripts.

    Here is the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
        <script type="text/javascript">
            Ext.calendar.template.BoxLayout.override({
                getTodayText : function(){
                    var dt = Ext.Date.format(new Date(), 'l, F j, Y'),
                        todayText = this.showTodayText !== false ? this.todayText : '',
                        timeText = this.showTime !== false ? ' <span id="'+this.id+'-clock" class="ext-cal-dtitle-time">' + 
                                //Ext.Date.format(new Date(), 'g:i a') + '</span>' : '',
                                Ext.Date.format(new Date(), 'H:i') + '</span>' : '',
                        separator = todayText.length > 0 || timeText.length > 0 ? ' &mdash; ' : '';
            
                    if(this.dayCount == 1){
                        return dt + separator + todayText + timeText;
                    }
                    fmt = this.weekCount == 1 ? 'D j' : 'j';
                    return todayText.length > 0 ? todayText + timeText : Ext.Date.format(new Date(), fmt) + timeText;
                }
            });
    
            Ext.calendar.view.Month.override({
                initClock: function() {
                    if (Ext.fly(this.id + '-clock') !== null) {
                        this.prevClockDay = new Date().getDay();
                        if (this.clockTask) {
                            Ext.TaskManager.stop(this.clockTask);
                        }
                        this.clockTask = Ext.TaskManager.start({
                            run: function() {
                                var el = Ext.fly(this.id + '-clock'),
                                t = new Date();
    
                                if (t.getDay() == this.prevClockDay) {
                                    if (el) {
                                        //el.update(Ext.Date.format(t, 'g:i a'));
                                        el.update(Ext.Date.format(t, 'H:i'));
                                    }
                                }
                                else {
                                    this.prevClockDay = t.getDay();
                                    this.moveTo(t);
                                }
                            },
                            scope: this,
                            interval: 1000
                        });
                    }
                }    
            });
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" Locale="pt-BR" />
        <ext:Viewport runat="server" Layout="FitLayout">
            <Items>
                <ext:CalendarPanel ID="CalendarPanel1" runat="server">
                    <EventStore runat="server" />
                    <DayView runat="server" TodayText="Hoje" />
                    <WeekView runat="server" TodayText="Hoje" />
                    <MonthView runat="server" TodayText="Hoje" />
                </ext:CalendarPanel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
  3. #3
    Hi Daniil!

    Thanks a lot for your scripts code... Works very well.

Similar Threads

  1. ext:CalendarPanel DayView formating Time in portuguese
    By gefferson.librelato in forum 1.x Help
    Replies: 7
    Last Post: Jan 25, 2013, 12:04 PM
  2. [CLOSED] ext:CalendarPanel: Event time is in English format
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 28, 2012, 7:28 PM
  3. Replies: 2
    Last Post: Mar 28, 2012, 1:39 PM
  4. [CLOSED] CalendarPanel : Today date
    By ddslogistics in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 01, 2011, 3:47 PM
  5. [CLOSED] Ext Throw format error when using Portuguese
    By sharif in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 02, 2010, 4:52 PM

Tags for this Thread

Posting Permissions