Localization: Ext.js language files not handled completely

  1. #1

    Localization: Ext.js language files not handled completely

    Hi,
    we use the existing translations of Ext.Js, located in the <Ext.Net basedirectory>\Ext.Net\Build\Ext.Net\extjs\src\loc ale folder for localization.

    This is working fine for many controls, but for the PagingToolbar it is only working partially. Some properties as beforePageText, nextText and others are just not handled.

    I have attached an example to reproduce the error easily.

    The attachment shows correct translations in green and missing in red.

    I assume this is a bug in Ext.Net. Am I right?

    Cheers,
    Ulf

    The sample code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Paging1.aspx.cs" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ 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">
    <script runat="server">
        private object[] TestData
        {
            get
            {
                return new object[]
                {
                    new object[] { "3m Co", 71.72},
                    new object[] { "Alcoa Inc", 29.01},
                    new object[] { "Altria Group Inc", 83.81 },
                    new object[] { "American Express Company", 52.55 },
                    new object[] { "American International Group, Inc.", 64.13 },
                    new object[] { "AT&T Inc.", 31.61},
                    new object[] { "Boeing Co.", 75.43},
                    new object[] { "Caterpillar Inc.", 67.27 },
                };
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            X.Js.Call("initLanguage");        
        }   
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = this.TestData;
                this.Store1.DataBind();             
            }
        }
        protected void MyData_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            this.Store1.DataSource = this.TestData;
            this.Store1.DataBind(); 
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <script type="text/javascript">
            function initLanguage() {
                if (Ext.PagingToolbar) {
                    Ext.apply(Ext.PagingToolbar.prototype, {
                        beforePageText: "Seite",
                        afterPageText: "von {0}",
                        firstText: "Erste Seite",
                        prevText: "vorherige Seite",
                        nextText: "nächste Seite",
                        lastText: "letzte Seite",
                        refreshText: "Aktualisieren",
                        displayMsg: "Anzeige Eintrag {0} - {1} von {2}",
                        emptyMsg: "Keine Daten vorhanden"
                    });
                }
            }           
        </script>        
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />    
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager runat="server" />                
            <ext:Store 
                ID="Store1"
                runat="server" 
                OnRefreshData="MyData_Refresh" >
                <Reader>
                    <ext:ArrayReader IDProperty="company">
                        <Fields>
                            <ext:RecordField Name="company" />
                            <ext:RecordField Name="price" Type="Float" />
                            <ext:RecordField Name="change" Type="Float" />
                            <ext:RecordField Name="pctChange" Type="Float" />
                            <ext:RecordField Name="lastChange" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>            
            </ext:Store>        
            <ext:GridPanel ID="GridPanel1" 
                runat="server" 
                StoreID="Store1" 
                Title="Array Grid" 
                Width="600" 
                Height="200">
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column ColumnID="Company" Header="Company" Width="160" DataIndex="company">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                        <ext:Column Header="Price" Width="75" DataIndex="price">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="5" />
                </BottomBar>
            </ext:GridPanel>          
        </form>
    </body>
    </html>
    Attached Thumbnails Click image for larger version. 

Name:	paginglocale.JPG 
Views:	616 
Size:	24.2 KB 
ID:	1997  
  2. #2
    Hi,

    Which Culture/Locale is this related to?
    Geoffrey McGill
    Founder
  3. #3
    Hi,
    it is for the German locale. I just copied the PagingToolbar part from the complete language file and put it inside the new initLanguage function. But I think it is a general problem it is not specific to any locale, because the prototype is set directly.

    Regards, Ulf

Similar Threads

  1. Replies: 11
    Last Post: Mar 20, 2013, 4:43 PM
  2. Ext.NET Post-back event handled globally
    By Nhím Hổ Báo in forum 1.x Help
    Replies: 3
    Last Post: Dec 31, 2011, 6:32 AM
  3. Replies: 0
    Last Post: Feb 14, 2011, 8:41 AM
  4. Gidpanel Language UI (localization)
    By hernanjls in forum 1.x Help
    Replies: 3
    Last Post: Oct 09, 2010, 11:14 AM
  5. Hot to completely disable SpinnerField?
    By pczyz in forum 1.x Help
    Replies: 1
    Last Post: Jul 28, 2010, 10:58 PM

Tags for this Thread

Posting Permissions