-
6 Jul 2011 1:29 AM #1
[4.0.4] Ext.MessageBox translations wrong
[4.0.4] Ext.MessageBox translations wrong
REQUIRED INFORMATION Ext version tested:
- Ext 4.0.1 up to 4.0.4
- FF5 (firebug 1.7.3 installed)
- Translations for Ext.MessageBox in locale/ext-lang-de.js files don't work. MessageBox doesn't show the translations for "ok", "cancel", "yes" and "no".
- Load the locale/ext-lang-de.js file and open a Ext.MessageBox.
- Look at the text of the buttons. They should be in the right language, but they aren't.
- The buttons should be in the right language.
- They aren't in the right language.
HELPFUL INFORMATION Debugging already done:Code:<script type="text/javascript" src="/js/ext4/locale/ext-lang-de.js"></script> ... Ext.MessageBox.show({ title: 'Löschen', msg: 'Soll der Datensatz wirklich gelöscht werden?', modal: true, icon: Ext.Msg.QUESTION, buttons: Ext.Msg.YESNO });
- locale/ext-lang-de.js
Operating System:Code:if(Ext.MessageBox){ Ext.MessageBox.buttonText = { ok : "OK", cancel : "Abbrechen", yes : "Ja", no : "Nein" }; // ADDED THIS TO DIRECTLY ASSIGN THE TEXT TO THE BUTTONS, AS BUTTONTEXT DOESN'T WORK 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; }- Windows 7
-
14 Jul 2011 12:38 PM #2
thanks
thanks
This was very usefull for me, I had the same problem.. The fix at least solves my problem for messagebox.
Would be nice if this was more generally configurable in Ext, also for update/cancel buttons in grids and so on..
-
31 Aug 2011 11:55 AM #3Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
This is fixed on the 4.0.7 branch and should not be needed in 4.1 and later due to some improvements to message box
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
22 Oct 2011 1:28 PM #4
This is fixed in 4.0.7 in the way the author offered but ... only for German locale file ext-lang-de.js. All other locale files do not have this fix and are still not localized.
PS
You have a nice feature in the ExtJS 3 for MessageBox - customizable texts for the buttons. In ExtJS 4, it could be implemented as follows
Example of call
Adjustment of the method MessageBox.reconfigureCode:Ext.MessageBox.show({ title: msg_Question, msg: msg_MsgAskInsertPosition, buttons: Ext.MessageBox.YESNOCANCEL, buttonText: {yes: 'Now', no: 'Later'}, icon: Ext.MessageBox.QUESTION, minWidth: 400, maxWidth: 600, fn: function(btn) { } });
Code:reconfigure: function(cfg) { var me = this, buttons = cfg.buttons || 0, hideToolbar = true, initialWidth = me.maxWidth, i; cfg = cfg || {}; me.cfg = cfg; if (cfg.width) { initialWidth = cfg.width; } // Default to allowing the Window to take focus. delete me.defaultFocus; // clear any old animateTarget me.animateTarget = cfg.animateTarget || undefined; // Defaults to modal me.modal = cfg.modal !== false; // Show the title if (cfg.title) { me.setTitle(cfg.title||' '); } if (!me.rendered) { me.width = initialWidth; me.render(Ext.getBody()); } else { me.setSize(initialWidth, me.maxHeight); } me.setPosition(-10000, -10000); // Hide or show the close tool me.closable = cfg.closable && !cfg.wait; me.header.child('[type=close]').setVisible(cfg.closable !== false); // Hide or show the header if (!cfg.title && !me.closable) { me.header.hide(); } else { me.header.show(); } // Default to dynamic drag: drag the window, not a ghost me.liveDrag = !cfg.proxyDrag; // wrap the user callback me.userCallback = Ext.Function.bind(cfg.callback ||cfg.fn || Ext.emptyFn, cfg.scope || Ext.global); // Hide or show the icon Component me.setIcon(cfg.icon); // Hide or show the message area if (cfg.msg) { me.msg.update(cfg.msg); me.msg.show(); } else { me.msg.hide(); } // Hide or show the input field if (cfg.prompt || cfg.multiline) { me.multiline = cfg.multiline; if (cfg.multiline) { me.textArea.setValue(cfg.value); me.textArea.setHeight(cfg.defaultTextHeight || me.defaultTextHeight); me.textArea.show(); me.textField.hide(); me.defaultFocus = me.textArea; } else { me.textField.setValue(cfg.value); me.textArea.hide(); me.textField.show(); me.defaultFocus = me.textField; } } else { me.textArea.hide(); me.textField.hide(); } // Hide or show the progress bar if (cfg.progress || cfg.wait) { me.progressBar.show(); me.updateProgress(0, cfg.progressText); if(cfg.wait === true){ me.progressBar.wait(cfg.waitConfig); } } else { me.progressBar.hide(); } if(cfg.buttonText && cfg.buttonText.ok) Ext.MessageBox.msgButtons['ok'].setText(cfg.buttonText.ok); else Ext.MessageBox.msgButtons['ok'].setText(Ext.MessageBox.buttonText.ok); if(cfg.buttonText && cfg.buttonText.cancel) Ext.MessageBox.msgButtons['cancel'].setText(cfg.buttonText.cancel); else Ext.MessageBox.msgButtons['cancel'].setText(Ext.MessageBox.buttonText.cancel); if(cfg.buttonText && cfg.buttonText.yes) Ext.MessageBox.msgButtons['yes'].setText(cfg.buttonText.yes); else Ext.MessageBox.msgButtons['yes'].setText(Ext.MessageBox.buttonText.yes); if(cfg.buttonText && cfg.buttonText.no) Ext.MessageBox.msgButtons['no'].setText(cfg.buttonText.no); else Ext.MessageBox.msgButtons['no'].setText(Ext.MessageBox.buttonText.no); // Hide or show buttons depending on flag value sent. for (i = 0; i < 4; i++) { if (buttons & Math.pow(2, i)) { // Default to focus on the first visible button if focus not already set if (!me.defaultFocus) { me.defaultFocus = me.msgButtons[i]; } me.msgButtons[i].show(); hideToolbar = false; } else { me.msgButtons[i].hide(); } } // Hide toolbar if no buttons to show if (hideToolbar) { me.bottomTb.hide(); } else { me.bottomTb.show(); } }
-
6 Feb 2013 10:21 AM #5
Hi,
I don't see this error fixed - even if Ext.MessageBox.msgButtons['yes'].text is correctly set the button labels are not getting translated... not for single (.NO) and and combinations (.YESNO) either.
I am using 4.1.3
Cheers
Florian
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-3909
in
4.0.7.



Reply With Quote