PDA

View Full Version : overriding component, in ordert to change languages



maria.chiamaia
21 Oct 2013, 1:08 AM
I have simpliest ExtJS Tree. Everything works! In API, I see that I can change titles and another labels by overriding it. Here is API link (http://dev.sencha.com/deploy/ext-4.0.0/examples/locale/dutch-form.html)



Ext.require(['*']);


Ext.define('My.Tree', {
extend:'Ext.tree.Panel',
id: 'DriveTree',
title: 'File Manager',
width: 500,
height: 650,
store: storeTree,
rootVisible: true,
renderTo: 'tree-div',

viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
appendOnly: true
}
},

useArrows: true,

dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'REFRESH TEXT', // TO BE MULTI LANGUAGE!
id:'connectButton',
},
{
text: 'SELECT TEXT', // TO BE MULTI LANGUAGE!
handler: function(){


Ext.Ajax.request({
url: '/json.json',
success: function(response, opts) {
Ext.MessageBox.alert('TITLE', 'TEXT'); // TO BE MULTI LANGUAGE
},

});

}
}]
}],


});

Ext.onReady(function(){
var tree =Ext.create('My.Tree', {});
});



ok. then I craete scripte-fr.js.

Ext.define('My.Tree', {
override: 'Ext.tree.Panel',
title: 'FRANCE TEXT',
});

But it does not work! it does get text from scripte-fr.js and also I need to have translateions in Ext.MessageBox.alert - can I do that?

scottmartin
24 Oct 2013, 6:46 AM
Have a closer look at the examples you posted a link to (prototype)

You may also be interested in this UX if you want a locale manager:
https://github.com/mitchellsimoens/Ux.locale.Manager

Scott.