1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default Question about LOCALIZATION

    Question about LOCALIZATION


    Hi,I have to create an application that has to be localized in English and Italian.

    I have find the way to link the locale file "ext-4.0.7-gpl/locale/ext-lang-it.js" in the index.html of my app.
    This solve the problem of localize the default of the Ext framework.

    My problem is : How can I localize english string about 'label','button text',or any other components I create in my app???

    Could someone give me some ideas???

    Thanks a lot and regards.

    Grubby

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Do exactly the same thing. Lets say you have some class:

    Code:
    Ext.define('MyClass', {
        myLabel: 'Foo'
    });
    Create your own app locale file with the appropriate translations.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Smile


    Hi evant!Thanks for the answer!

    I have tried this :
    In my app I define a new class extended window and setting a title in english.

    Code:
    Ext.define('ConfMailWindow', {
                extend: 'Ext.window.Window',
                title: 'SIMULATION',
                
            });
    After in the ext locale file I add :

    Code:
    if(ConfMailWindow){
           Ext.apply(ConfMailWindow.prototype, {
              title : "SIMULAZIONE"
           });
        }
    and linking the locale in index.html all is ok!!!

    BUT!!!

    If I want to add items components in my window or any buttons with text and labels...how can I write the code in the class and in the locale file?
    Let me say that ,after create my class (my FIRST define class..... sorry but I am new here),I create the object in the app and add inside all the components and buttons ,like this:

    Code:
    Ext.create('ConfMailWindow',{
                      //title: 'SIMULAZIONE',
                      id: 'simulazione',
                    height: 200,
                    width: 300,
                    layout: 'absolute',
                    modal: true,
                    items: [{
                        xtype: 'label',
                        x: 10,
                        y: 10,
                        //html: obj.data3
                        html: message
                    },{
                          xtype: 'checkbox',  //check per mail di conferma registrazione
                        boxLabel: 'Mail',
                        id: 'checkmail',
                        x: 10,
                        y: 80
                      }],
                      buttons: [{ 
                          //text: 'OK',
                          
                          handler: function(){
                              var details = new Object;
                                details.Mail = E
    ............
    ......
    ....

    Thnaks a lot!!!!

    Grubby

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You can't do it quite like that.

    Instead:

    Code:
    Ext.define('MyClass', {
        myLabel: 'Foo',
        
        initComponent: function(){
            this.buttons = [{
                text: this.myLabel
            }];
            // other stuff
            this.callParent();
        }
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default


    This is very cool!!!

    Now I will try to app this code!
    And a last question...
    If I want to pass a variable inside the new created object ,how can i write the code?

    Code:
    Ext.create('ConfMailWindow',{
          			//title: 'SIMULAZIONE',
          			id: 'simulazione',
        			height: 200,
        			width: 300,
        			layout: 'absolute',
        			modal: true,
        			items: [{
        				xtype: 'label',
        				x: 10,
                        y: 10,
        				//html: obj.data3
        				html: message
        			},{
    This is my first code and if I want to have the variable 'message' inside the window,how can I write in the definition class???
    Because the 'message' is created after ,doing an AJAX request and using a Json object from the php server...

    Thanks evant!!!

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default


    Now,I think I have resolved my problem,but I wish you/someone other look at my code and tell me if I have done in a right way.

    This is my code:

    Code:
    //definizione window class x mail di conferma
            Ext.define('ConfMailWindow', {
                extend: 'Ext.window.Window',
                
                //Inizializzazione properties di default in inglese
                title: 'SIMULATION',
                myButtonText: 'OK',
                myBoxLabel: 'Mail',
                myMessage: '',
                myIdUser: 0,
                
                id: 'simulazione',
                height: 200,
                width: 300,
                layout: 'absolute',
                modal: true,
                //Inizializzazione componenti
                initComponent: function(){
                
                    this.items = [{
                        xtype: 'label',
                        x: 10,
                        y: 10,
                        html: this.myMessage
                        //html: this.myIdUser
                    },{
                          xtype: 'checkbox',  //check per mail di conferma registrazione
                        boxLabel: this.myBoxLabel,
                        id: 'checkmail',
                        x: 10,
                        y: 80
    
    
                    }];
                
                    this.buttons = [{
                    
                        text: this.myButtonText,
                        myButIdUser: this.myIdUser,
                        
                        handler: function(){
                              var details = new Object;
                                details.Mail = Ext.getCmp('checkmail').getValue();                
                                details.Iuser = this.myButIdUser;
                                                                                                                        
                                  Ext.Ajax.request({
                                    url: '../mail_registration.php',
                                    params:  {data: Ext.encode(details)},
                                    success: function(response, opts) {
                                                Ext.getCmp('simulazione').close();
                                                                                    
                                                var obj = Ext.decode(response.responseText);
                                                Ext.Msg.alert('ATTENZIONE', obj.data1, function(){
                                                      Ext.getCmp('login').getForm().reset();    
                                                  });
                                      }
                                  });
                          } 
    
    
                    }];
                    // other stuff
                    this.callParent();
                }
                
            });
        
                
            //Funzione di simulazione mail di conferma
            confMail = function(message, idUser){
                              
                  Ext.create('ConfMailWindow',{
                      myMessage: message,
                      myIdUser: idUser
                  }).show();
                  
                  
              }
    Doing in this way,I can pass troght a function (confMail) the variables that after I use to initialize my object ConfMailWindow.

    Is it correct to write in this way to have the right value???

    Code:
    this.buttons = [{
                    
                        text: this.myButtonText,
                        myButIdUser: this.myIdUser,
                        
                        handler: function(){
                              var details = new Object;
                                details.Mail = Ext.getCmp('checkmail').getValue();                
                                details.Iuser = this.myButIdUser;
    ..or there is another right way???

    Thanks a lot!!!

    Bye Grubby

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi