PDA

View Full Version : xds and multilanguage app



padawan
3 Nov 2010, 9:58 PM
I am starting to work on my first "big app" and I would like to have my mind right before I do something stupid... :s Just a dummy example first with three panels:

MyPanelUi = Ext.extend(Ext.Panel, {
title: 'Main panel',
width: 400,
height: 250,
layout: 'hbox',
initComponent: function() {
this.items = [
{
xtype: 'panel',
title: 'Sub panel 1',
flex: 1
},
{
xtype: 'panel',
title: 'Sub Panel 2',
flex: 1
}
];
MyPanelUi.superclass.initComponent.call(this);
}
});

MyPanel = Ext.extend(MyPanelUi, {
initComponent: function() {
MyPanel.superclass.initComponent.call(this);
}
});

If I got it right, I should try to override the public variables in my lang file, something like this

if(MyPanel) {
Ext.apply(MyPanel.prototype, {
title: 'Main panel using another title language',
});
}
But how do I handle the sub panels? Should I promote both of them to classes or is there some other way I might consider?

jarrednicholls
4 Nov 2010, 8:53 AM
Hi padawan,

At this point you could promote them to classes of their own as the easiest approach. The next generation of the Designer is putting all stringed values up into a "strings" object on the top class, and it will have keys for each sub-component and their related strings. Then the actual configuration of the sub-components in "this.items" would reference the "strings" object. Thus, you will be able to override all strings on the prototype of the class for localization.

padawan
4 Nov 2010, 10:35 PM
Hi jarrednicholls,

many thanks for the info. The Designer is great but there are so many things for me to learn. I can feel the Force but unfortunately I cannot control it yet ;)

devtig
3 Apr 2011, 9:22 PM
bump