-
9 Nov 2011 6:39 AM #1
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
-
Best Answer Posted by burnnat
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' }] }); }
-
9 Nov 2011 6:48 AM #2
-
9 Nov 2011 7:07 AM #3
No ... thank you!!!
-
9 Nov 2011 7:30 AM #4
Thats works with messages and date stuff, but for my labels or my messages in the js files?
In the guide there is:
That works perfectly with Extjs widgets but not for my labels ...Code:setup: function() { Ext.create('Ext.FormPanel', { renderTo: 'datefield', frame: true, title: 'Date picker', width: 380, defaultType: 'datefield', items: [{ fieldLabel: 'Date', name: 'date' }] }); }
Let me explain:
I want to change the title property like:
where getLabel("DatePicker") returns the right label with the text of the appropriate language ...Code:setup: function() { Ext.create('Ext.FormPanel', { renderTo: 'datefield', frame: true, title: getLabel("DatePicker"), width: 380, defaultType: 'datefield', items: [{ fieldLabel: 'Date', name: 'date' }] }); }
-
9 Nov 2011 7:45 AM #5
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 }); }
-
9 Nov 2011 7:53 AM #6
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' }] }); }
-
10 Nov 2011 1:22 AM #7
The last one fit perfectly for me!
Thank you for the fast answer!


Reply With Quote