PDA

View Full Version : Advice needed - how to implement a multi-language form-field



mx_starter
4 Jan 2013, 2:42 AM
Hello,
i have a simple form which will serve as a CMS tool for updating a site.
The site itself is maintained in 2 languages - lets say - ENG and FR.

So - a user has to create an article, whose title must be entered in English and French.
Which means - the appropriate field (or fields) must keep / submit two different values.

My plan is to create 2 different fields (one for every languge) and to hide/show the appropriate one dynamically - for example - on click on a "language flag" icon.

But before digging within, i want to ask you guys for an advice - which is the best way to accomplish this?

Maybe - there is some user extension already?

Thanks in advance!

friend
4 Jan 2013, 7:37 AM
http://docs.sencha.com/ext-js/4-1/#!/guide/localization

mx_starter
4 Jan 2013, 8:28 AM
http://docs.sencha.com/ext-js/4-1/#!/guide/localization

Well, i expected such an answer :)
However, this is not i asked for. May be my bad English is the reason.

Anyway, managed to reach similar effect using custom triggerfield

friend
4 Jan 2013, 9:57 AM
Your language skills are excellent; I just wanted to make sure you'd seen the default blurb about localization...

:]

mx_starter
6 Jan 2013, 3:43 AM
Well - i managed to implement this field:
41118

using code like this:



Ext.define('Ext.ux.FlagTrigger', {
extend: 'Ext.form.field.Trigger',
alias: 'widget.sbgTrigger-Flag',
triggerCls: 'sbg-flagTrigger-EN',

onTriggerClick: function() {
this.triggerCls = 'sbg-flagTrigger-FR';
},


as you can see - this is a trigger field with custom triggerCls.

Is it possible the triggerCls config property to be changed dynamically once the component is rendered?
The line in blue above does nothing for me - the console shows the property is changed, but the icon itself remains the same, the flag is not switched