-
11 Sep 2012 4:45 AM #41Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
You can add javascript resources to your project but that won't create the anything for you to directly use. In code you can use it and of course you can create your own configs but I don't think the custom configs will support objects as you need to specify for locale
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Sep 2012 2:10 AM #42
Please, give a complete example - where, what, and how ...
-
15 Sep 2012 5:53 AM #43
...?????
-
19 Oct 2012 10:30 AM #44
mitchellsimoens , can you describe how to easily integrate it with Sencha Architect 2???
Thank you for the quick response ...
-
19 Oct 2012 11:48 AM #45
I can answer that I guess.
I'm using Architect so it is possible. You just don't see the text inside your app.
Inside the root folder of your app.html '/' add the files like: Ux/locale/Manager.js etc
Inside the root folder of your app.html '/' add a folder for your translations: '/locales'
Inside 'Application' within Architect, add them all as requires like:
Ux.locale.Manager
Ux.locale.override.st.Component
etc
etc
Inside 'Application > Launch add the init code
Go to some sort of component that you want translating. and just add a custom parameter: locales: {html: "blah blah"}
-
19 Oct 2012 1:40 PM #46
thx
problem in ext.window.Window (SA2) ::: title
Ext.ComponentQuery.query('component[enableLocale]') >> []
PHP Code:Ext.define('MBD.view.bodys.Window', {
extend: 'Ext.window.Window',
alias: 'widget.BodysWindow',
requires: [
'MBD.view.bodys.Form'
],
itemId: 'BodysWindow',
minHeight: 40,
width: 400,
resizable: false,
layout: {
type: 'fit'
},
bodyPadding: 3,
title: 'Body edition',
constrainHeader: true,
modal: true,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
locales: {
title: 'windows.titles.bodys'
},
items: [
{
xtype: 'BodysForm'
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
items: [
{
xtype: 'tbfill'
},
{
xtype: 'button',
itemId: 'btSaveForm',
text: 'Save'
},
{
xtype: 'tbseparator'
},
{
xtype: 'button',
itemId: 'btClearForm',
text: 'Clear'
}
]
}
],
listeners: {
beforerender: {
fn: me.onBodysWindowBeforeRender,
scope: me
}
}
});
me.callParent(arguments);
},
onBodysWindowBeforeRender: function(abstractcomponent, options) {
Ux.locale.Manager.init();
}
});
-
26 Oct 2012 3:08 AM #47
new locales for grid column (extjs4);-)
PHP Code:Ext.define('Ux.locale.override.extjs.HeaderContainer', {
override : 'Ext.grid.header.Container',
requires : [
'Ux.locale.override.extjs.Component'
],
setLocale : function(locale) {
var me = this,
locales = me.locales,
text = locales.text,
manager = me.locale,
defaultText = '';
if (text) {
if (Ext.isObject(text)) {
defaultText = text.defaultText;
text = text.key;
}
text = manager.get(text, defaultText);
if (Ext.isString(text)) {
me.setText(text);
}
}
me.callOverridden(arguments);
},
setText : function(text) {
this.textEl.update(text);
this.text = text;
return this;
}
});
-
8 Nov 2012 6:20 AM #48
Using Ux.locale.Manager.get() when loading classes.
Using Ux.locale.Manager.get() when loading classes.
I'd like to translate dataview.List#emptyText, but I'm using some HTML there and I'd like to avoid putting it in translated text. Is there any way to do it?
The way Sencha loads classes, makes Ux.locale.Manager unavailable while loading classes (I'm loading in inside Ext.application#requires and then initializing it inside Ext.application#launch method), so I guess something like this won't work:
I've got the same issue in other places as well e.g. with templates. In Ext.Panel view I'm using quite a long template - is there a way to translate just parts of the template, so that I don't have to put the whole template into translated text?Code:Ext.define("MyApp.view.List", { config: { emptyText: "<lots of html>" + Ux.locale.Manager.get("emptyText") + "</lots of html>" }, });
It looks like Sencha in most places accepts only strings, which are evaluated when class is loaded and doesn't allow to pass e.g. functions that return strings to defer their evaluation.
-
12 Nov 2012 3:45 AM #49
Hi Mitchell,
I have some problems with this plugin, maybe you can help me.
I´m using Ux.locale.Manager.setConfig like this
Ux.locale.Manager.setConfig({
ajaxConfig : {method : 'GET'},
language : 'pt',
tpl : './locales/pt.json',
type : 'ajax'
});
Ux.locale.Manager.init();
where pt.json is something like this:
{"buttons": {"cancel":"Cancelar","save":"Guardar","done":"OK"},"months": {"1": "Janeiro","2": "Fevereiro","3": "Março","4": "Abril","5": "Maio","6": "Junho","7": "Julho","8": "Agosto","9": "Setembro","10": "Outubro","11": "Novembro","12": "Dezembro"}}
No problem so far. I´m trying apply this into Date Picker. Works good on Browser - Chrome. However, when i´m using phonegap, the location doesn´t work anymore.
You said that the application must run through a web server. What this mean? Means that I can´t work on phonegap?
Thanks in advance,
-
11 Dec 2012 7:42 AM #50
Need to use locale changing within an itemTpl... anyone come up with anything yet for this that they're cool to share?
For instance:
Code:// In other HTML text I did something like {{Text to translate}} for translating things but here it would probably mess up <div> <div>Type: {type}</div> <div>Status: {status}</div> </div>


Reply With Quote