Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Conversation

@tralves
Copy link

@tralves tralves commented Jun 12, 2013

Description:

Added support for tpl localization.

Notes:
Only implemented for Sencha Touch! Not Ext.
Only tested on ST 2.2.1

This was implemented in the Component override, so it should work with every component child object.

Usage:

  1. Create the component with the data and locales.tpl like so:
var welcomePanel = {
    xtype: "panel",
    data: {
        name: VSBabyMobile.app.vsbUser.get("UserName")
    },
    locales: {
        tpl: "home_screen.hello"
    }
};

or:

var welcomePanel = {
    xtype: "panel",
    data: {
        name: VSBabyMobile.app.vsbUser.get("UserName")
    },
    locales: {
        tpl: {
            defaultTpl: "Hello {name} and welcome!",
            key: "home_screen.hello"
        }
    }
};
  1. The locales/{locale}.json file will have the template:
"home_screen": {
    "hello":"Olá {name} e bem vindo!",
}

tralves added 2 commits June 12, 2013 16:02
Added support for template localization.
Couldn't find a better way to update the template other than setting the data again...
Match indentation
@mitchellsimoens
Copy link
Owner

Looks pretty good! I'm gonna find some time to test this with ST2 and Ext JS4 before I merge it but looks like it should work for both. Well, maybe not the getters but we shall see :)

Initialize defaultTpl.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants