Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJSIV-3909 in 4.0.7.
  1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Germany
    Posts
    31
    Vote Rating
    0
    SunnySven is on a distinguished road

      0  

    Default [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
    Browser versions tested against:
    • FF5 (firebug 1.7.3 installed)
    Description:
    • 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".
    Steps to reproduce the problem:
    • 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 result that was expected:
    • The buttons should be in the right language.
    The result that occurs instead:
    • They aren't in the right language.
    Test Case:
    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
        });
    HELPFUL INFORMATION Debugging already done:
    • locale/ext-lang-de.js
    Possible fix:
    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;
        }
    Operating System:
    • Windows 7

  2. #2
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    28
    Vote Rating
    1
    allardp is on a distinguished road

      0  

    Default 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..

  3. #3
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,941
    Vote Rating
    6
    edspencer has a spectacular aura about edspencer has a spectacular aura about edspencer has a spectacular aura about

      0  

    Default


    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

  4. #4
    Sencha User
    Join Date
    Jun 2008
    Posts
    267
    Vote Rating
    12
    Qtx will become famous soon enough

      0  

    Default


    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

    Code:
      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) {
        }
      });
    Adjustment of the method MessageBox.reconfigure

    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();
            }
        }

  5. #5
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    44
    Vote Rating
    1
    mikih is on a distinguished road

      0  

    Exclamation


    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