1. #1
    Sencha User
    Join Date
    Mar 2011
    Location
    Pavia, Italy
    Posts
    30
    Answers
    1
    Vote Rating
    0
    Cougar84 is on a distinguished road

      0  

    Default Answered: Extjs 4 Multilanguage

    Answered: Extjs 4 Multilanguage


    Hi, i'm trying to develop a multi language application in Extjs 4 and I haven't found yet a good solution to change labels & messages in js file.

    Have you found a good solution to make Extjs 4 multi language?

    Thanks
    Marco

  2. Alternatively, (but not that I'd necessarily recommend this approach) you could store all the labels together:
    Code:
    // Define a class with the labels you want
    Ext.define('MyApp.Labels', {
        singleton: true,
        date: 'Date Picker',
        color: 'Color Picker',
        nose: 'Nose Picker'
    });
    Code:
    // In your 'LeetSpeak' localization file
    if (MyApp.Labels){
        Ext.apply(MyApp.Labels, {
            date: "D473 P1(|<3r",
            color: "(0L0r P1(|<3r",
            nose: "|\|0$3 P1(|<3r"
        });
    }
    Code:
    // To instantiate
    setup: function() {
        Ext.create('Ext.FormPanel', {
            renderTo: 'datefield',
            frame: true,
            title: MyApp.Labels.date,
            width: 380,
            defaultType: 'datefield',
            items: [{
                fieldLabel: 'Date',
                name: 'date'
            }]
        });
    }

  3. #2
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Answers
    40
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Have you read the ExtJS localization guide?

  4. #3
    Sencha User
    Join Date
    Mar 2011
    Location
    Pavia, Italy
    Posts
    30
    Answers
    1
    Vote Rating
    0
    Cougar84 is on a distinguished road

      0  

    Default


    No ... thank you!!!

  5. #4
    Sencha User
    Join Date
    Mar 2011
    Location
    Pavia, Italy
    Posts
    30
    Answers
    1
    Vote Rating
    0
    Cougar84 is on a distinguished road

      0  

    Default


    Thats works with messages and date stuff, but for my labels or my messages in the js files?

    In the guide there is:

    Code:
    setup: function() {
        Ext.create('Ext.FormPanel', {
            renderTo: 'datefield',
            frame: true,
            title: 'Date picker',
            width: 380,
            defaultType: 'datefield',
            items: [{
                fieldLabel: 'Date',
                name: 'date'
            }]
        });
    }
    That works perfectly with Extjs widgets but not for my labels ...

    Let me explain:
    I want to change the title property like:

    Code:
     
    setup: function() {
        Ext.create('Ext.FormPanel', {
            renderTo: 'datefield',
            frame: true,
            title: getLabel("DatePicker"),
            width: 380,
            defaultType: 'datefield',
            items: [{
                fieldLabel: 'Date',
                name: 'date'
            }]
        });
    }
    where getLabel("DatePicker") returns the right label with the text of the appropriate language ...

  6. #5
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Answers
    40
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    You should be able to follow the same pattern that ExtJS uses:

    Code:
    // Define a class with the labels you want
    Ext.define('MyApp.DateForm', {
        extend: 'Ext.form.Panel',
        frame: true,
        title: 'Date Picker',
        defaultType: 'datefield',
        items: [{
            fieldLabel: 'Date',
            name: 'date'
        }]
    });
    Code:
    // In your 'LeetSpeak' localization file
    if (MyApp.DateForm){
        Ext.apply(MyApp.DateForm, {
            title: "D473 P1(|<3r"
        });
    }
    Code:
    // To instantiate
    setup: function() {
        Ext.create('MyApp.DateForm', {
            renderTo: 'datefield',
            width: 380
        });
    }

  7. #6
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    410
    Answers
    40
    Vote Rating
    55
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Alternatively, (but not that I'd necessarily recommend this approach) you could store all the labels together:
    Code:
    // Define a class with the labels you want
    Ext.define('MyApp.Labels', {
        singleton: true,
        date: 'Date Picker',
        color: 'Color Picker',
        nose: 'Nose Picker'
    });
    Code:
    // In your 'LeetSpeak' localization file
    if (MyApp.Labels){
        Ext.apply(MyApp.Labels, {
            date: "D473 P1(|<3r",
            color: "(0L0r P1(|<3r",
            nose: "|\|0$3 P1(|<3r"
        });
    }
    Code:
    // To instantiate
    setup: function() {
        Ext.create('Ext.FormPanel', {
            renderTo: 'datefield',
            frame: true,
            title: MyApp.Labels.date,
            width: 380,
            defaultType: 'datefield',
            items: [{
                fieldLabel: 'Date',
                name: 'date'
            }]
        });
    }

  8. #7
    Sencha User
    Join Date
    Mar 2011
    Location
    Pavia, Italy
    Posts
    30
    Answers
    1
    Vote Rating
    0
    Cougar84 is on a distinguished road

      0  

    Default


    The last one fit perfectly for me!

    Thank you for the fast answer!

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar