Results 1 to 4 of 4

Thread: about localization

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    China
    Posts
    31
    Answers
    1

    Question Answered: about localization

    version: extjs4
    The button's text is still "ok", but when I use a datefield, it show chinese text
    Code:
    <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css">
    <script type="text/javascript" src="ext-all.js"></script>
    <script type="text/javascript" src="ext-lang-zh_CN.js"></script>
    <script>
                Ext.onReady(function(){
                 Ext.MessageBox.alert("SDF", "SDF");
                });
     </script>

  2. Quote Originally Posted by skirtle View Post
    Agreed. Seems to be a bug. Same for the other locale files too.

    Looks like the buttons for the messagebox singleton are created immediately, so the locale file changes the buttonText values too late.

    To work round this problem I think you'll have to grab the buttons themselves and change the text directly.
    I found it. It isn't use buttonText to initialize MessageBox, it is use msgButtons.
    I changed the locale file like follow. It can work.

    Code:
        if(Ext.MessageBox){
           Ext.MessageBox.buttonText = {
              ok     : "??",
              cancel : "??",
              yes    : "?",
              no     : "?"
           };
        Ext.MessageBox.msgButtons.ok.text = "??";
        Ext.MessageBox.msgButtons.yes.text = "?";
        Ext.MessageBox.msgButtons.cancel.text = "??";
        Ext.MessageBox.msgButtons.no.text = "?";
        }

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Agreed. Seems to be a bug. Same for the other locale files too.

    Looks like the buttons for the messagebox singleton are created immediately, so the locale file changes the buttonText values too late.

    To work round this problem I think you'll have to grab the buttons themselves and change the text directly.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    China
    Posts
    31
    Answers
    1

    Default

    Quote Originally Posted by skirtle View Post
    Agreed. Seems to be a bug. Same for the other locale files too.

    Looks like the buttons for the messagebox singleton are created immediately, so the locale file changes the buttonText values too late.

    To work round this problem I think you'll have to grab the buttons themselves and change the text directly.
    I found it. It isn't use buttonText to initialize MessageBox, it is use msgButtons.
    I changed the locale file like follow. It can work.

    Code:
        if(Ext.MessageBox){
           Ext.MessageBox.buttonText = {
              ok     : "??",
              cancel : "??",
              yes    : "?",
              no     : "?"
           };
        Ext.MessageBox.msgButtons.ok.text = "??";
        Ext.MessageBox.msgButtons.yes.text = "?";
        Ext.MessageBox.msgButtons.cancel.text = "??";
        Ext.MessageBox.msgButtons.no.text = "?";
        }

  5. #4
    Sencha User
    Join Date
    Dec 2010
    Location
    Tehran, Iran
    Posts
    6

    Default

    it work, thank you

    Quote Originally Posted by kyousuke View Post
    I found it. It isn't use buttonText to initialize MessageBox, it is use msgButtons.
    I changed the locale file like follow. It can work.

    Code:
        if(Ext.MessageBox){
           Ext.MessageBox.buttonText = {
              ok     : "??",
              cancel : "??",
              yes    : "?",
              no     : "?"
           };
        Ext.MessageBox.msgButtons.ok.text = "??";
        Ext.MessageBox.msgButtons.yes.text = "?";
        Ext.MessageBox.msgButtons.cancel.text = "??";
        Ext.MessageBox.msgButtons.no.text = "?";
        }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •