This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Home
Maximiliano Fierro edited this page Jan 2, 2014
·
2 revisions
##Using Ext.i18n.Bundle with your Sencha Touch App
- First copy the
i18n
folder to your root folder. - Add the namespace
Ext.i18n
to the loader:
Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext.i18n': 'i18n'
}
});
- Now config your app to use the Bundle extension:
Ext.application({
name: 'AppTest',
requires: ['Ext.i18n.Bundle'],
bundle: {
bundle: 'Application',
lang: 'es-ES',
path: 'resources',
noCache: true
},
launch: function(){
Ext.create('Ext.Panel',{
fullscreen: true,
items: [
{
xtype: 'titlebar',
docked: 'top',
title: {type: 'bundle', key: 'panel.title'}
}
],
tpl: [ //4
'Hello {name}! <br>',
'{[this.getMsgFromResources()]}',
{
getMsgFromResources: function(){
return AppTest.app.bundle.getMsg('panel.html');
}
}
],
data: {name: 'Joe'}
});
}
});
- Add your
.properties
files into theresources
folder
##Using Ext.i18n.Bundle with Sencha Cmd
In case you are using Sencha Cmd there are a few changes you have to do in order that Cmd can pick up the dependencies and build the project correctly:
- Edit your
.sencha/app/sencha.cfg
and add thei18n
folder into the class path:
app.classpath=${app.dir}/app.js,${app.dir}/app,${app.dir}/i18n
- Now you have to run refresh command so Cmd can recreate the bootstrap.js file and dependencies
sencha app refresh
- Last step is to add your
.properties
files references intoapp.json
file so Cmd build can pick them up when creating builds. To do so, just add them into the resources section:
"resources": [
"resources/images",
"resources/icons",
"resources/startup",
"resources/Application.properties",
"resources/Application_en-US.properties",
"resources/Application_es-ES.properties"
],
Done! Now you are ready to start testing your app in development. Once you are ready you can create your testing or production builds with:
sencha app build production