Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
[4.1] Adding buttonText config to Ext.Msg.show adds the translated buttons
REQUIRED INFORMATION
Ext version tested:
Browser versions tested against:
- FF12 (firebug 1.9.1 installed)
- Chrome 18
DOCTYPE tested against:
Description:
- When adding translations to the Ext.Msg.show method with the "buttonText" config, it adds the buttons that are translated instead of using the "buttons" config..
Steps to reproduce the problem:
Code:
Ext.Msg.show
({
msg: "message",
title: "title",
buttons: Ext.MessageBox.OKCANCEL,
icon: Ext.MessageBox.ERROR,
buttonText :
{
ok : "OK",
cancel : "Annuler",
yes : "Oui",
no :"No"
}
});
The result that was expected:
- A message box with OK and CANCEL buttons.
The result that occurs instead:
- A message box with OK, CANCEL, YES and NO buttons.
HELPFUL INFORMATION
Additional CSS used:
Operating System:
-
Sencha User
Up !
Got exactly the same bug !
Have anyone of the team seen that post ??
Cheers
-
Please try the following:
Code:
Ext.onReady(function() {
var messageBox = Ext.create('Ext.window.MessageBox', {
buttonText: {
ok : "OK",
cancel : "Annuler",
yes: 'Oui',
no: 'Non'
}
});
messageBox.show({
title: "A Title",
msg: 'A Message',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.WARNING
});
});?
Scott.
-
Sencha User
Hi Scott,
Thanks it works but.. is my test case wrong ?
-
I would have to research this. I believe there is a quirk that allows your approach to fail.
Scott.
-
This is actually the intended behaviour. It allows you to pass custom button text for a particular instance.
If you want to override them globally, you can use:
Code:
Ext.MessageBox.buttonText = {
ok: "Foo",
cancel: "Bar",
yes: "Baz",
no: "Bleh"
};
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.