PDA

View Full Version : Localization



vipul3483
5 Apr 2016, 3:04 AM
Hi,

I need to display my text for ex: over here "I Have an Account" in different languages based on user selection and have below code in many files. Can you please suggest a generic solution to localize such fields ?

Ext.define("MyPortal.view.CustomerLogInForm", {
extend: 'Ext.panel.Panel',
alias: 'widget.customerlogin',
id: 'loginform',

layout: {
type: 'fit'
},
initComponent: function(){
var me = this;
me.border = false;
me.baseCls = 'bodyColor';
me.items = [{
xtype: 'form',
baseCls: 'bodyColor',
controller: null,
id: 'customerLogInForm',
items: [{
xtype: 'displayfield',
margin: '5 0 -2 15',
width: '100%',
value: '<h3>I Have an Account</h3>'
},

Hoping you reply at the earliest.
Thanks in advance

Gary Schlosberg
5 Apr 2016, 11:40 AM
Have you looked at the localization guide?
http://docs.sencha.com/extjs/4.2.5/#!/guide/localization

vipul3483
5 Apr 2016, 11:57 AM
Yes I had a look at this one but am finding it difficult to override the value fields of xtype: displayField for my custom component in the code snippet.

Can you please share some example for similar scenario ?

Many Thanks
Vipul

Gary Schlosberg
5 Apr 2016, 1:13 PM
I'm afraid I don't have sample code for this myself, but perhaps someone else will share. But as far as a generic solution, the locale files are a good model to follow.

vipul3483
5 Apr 2016, 8:10 PM
Thanks for your inputs, much appreciated.

Yes I do agree with you and have decided to go with that approach but the major roadblock for me right now is the syntax to implement the same :(

I am struggling to find any such code snippets to follow.