Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    jst@pe is on a distinguished road

      0  

    Default How to set the calculated title of a panel?

    How to set the calculated title of a panel?


    Hi,

    I would like to set the title of a panel to a result of a method call.
    Right now I have:
    Code:
    title: 'Rulesets'
    I would like to use the following code to set the title:
    Code:
    title: i18n.get('title.Rulesets')
    Is that possible in Sencha Architect? Are there other tips for internationalization?

    Thanks,
    Jan

  2. #2
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    522
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    Check out this link. Might help you understand localization. Another approach, here. And another one, here, written by one of the sencha developers.

    Keep in mind, all of your components expose events. Consider a panel with several labels on it. When the panel initializes, you have the opportunity to set the labels value at that time.

    Hope that helps get you started,
    John

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    jst@pe is on a distinguished road

      0  

    Default Thanks, but not working in Architect

    Thanks, but not working in Architect


    Thanks for your reply. But neither of these approaches can be used with Sencha Architect. Both approches require the title to be declared as JavaScript code. So either it would have to be:
    Code:
    title: i10n.translate("checkin.error.nickname", 3, 25) // 1st way
    title: Messages.CHECKIN_ERROR // 2nd way
    Yet if I enter that in Architect I get:
    Code:
    title: 'i10n.translate("checkin.error.nickname", 3, 25)' // 1st way
    title: "Messages.CHECKIN_ERROR" // 2nd way
    That's exactly my problem. Architect escapes everything as String. Otherwise I would not have posted this.

  4. #4
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    522
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    again, in the init event of your parent container or anywhere else in the code that fires prior to showing your labels do something like this:

    this.down('#MyLabelsItemID').setValue('my value');

    or

    this.down('#MyLabelsItemID').setValue(i10n.translate("checkin.error.nickname", 3, 25));


Thread Participants: 1

Tags for this Thread