I want to localize the yes no text of button in extjs 4.1. I tried to change ext-lang-xx.js file but it doesn't work. Any suggestions please?
I want to localize the yes no text of button in extjs 4.1. I tried to change ext-lang-xx.js file but it doesn't work. Any suggestions please?
Yes and No buttons for which component?
Hi new2extjs,
See this thread-
http://www.sencha.com/forum/archive/...t-231440.html?
sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
I have this message.
I want to localize the yes, no, cancel of buttons. I have modified the ext-lang-xx.js file by adding this:Code:Ext.Msg.show({ title: "test", msg: "test", buttons: Ext.MessageBox.YESNOCANCEL, closable: true, fn: function( ){ } });
But the change isnot reflected in the message box buttons. How can I resolve this?Code:Ext.MessageBox.msgButtons['cancel'].text = "test"; Ext.MessageBox.msgButtons['yes'].text = "test"; Ext.MessageBox.msgButtons['no'].text = "test";
the way you are doing it is working in ExtJS 4.0.7 but not in 4.1.x. Change like this:
Code:// Add this to your locale file; remove the lines which you have posted above! they were meant to be removed for ExtJS 4.1.x if(Ext.MessageBox){ Ext.MessageBox.buttonText = { ok : "TestOK", cancel : "TestCancel", yes : "TestYes", no : "TestNo" }; } // Now you can create a message box like this in your app: Ext.Msg.show({ title:'Messagebox Title', msg: 'Are you sure want to delete?', buttons: Ext.Msg.YESNOCANCEL });
the locale file has the following comments:
Because of an earlier issue, the following 4 lines were added below these comments (which are no longer needed for ExtJS 4.1.x:// As of 4.0.4, setting the buttonText above does not take effect properly. This should be removable in 4.1.0
// (see issue EXTJSIV-3909)
Code:Ext.MessageBox.msgButtons['ok'].text = Ext.MessageBox.buttonText.ok; Ext.MessageBox.msgButtons['cancel'].text = Ext.MessageBox.buttonText.cancel; Ext.MessageBox.msgButtons['yes'].text = Ext.MessageBox.buttonText.yes; Ext.MessageBox.msgButtons['no'].text = Ext.MessageBox.buttonText.no;
Thanks for the reply. I have removed those lines. But still the buttons yes, no , cancel are coming in English eventhough the message is coming in another language. Do I have to add something to the file where I have written the code for message or in some other file ?
no you dont have to add anything else. Just remove those 4 lines and change the text in that object in the locale file. then you can just create a message box like this:
Code:Ext.Msg.show({ title: "test", msg: "test", buttons: Ext.MessageBox.YESNOCANCEL, closable: true, fn: function( ){ } });
add this code in your app JS file before creating any message boxes and see if it changes anything:
If this works, then there may be a problem in loading the locale file. It might not be loaded before the message box is being created...Code:if(Ext.MessageBox){ Ext.MessageBox.buttonText = { ok : "TestOK", cancel : "TestCancel", yes : "TestYes", no : "TestNo" }; }