PDA

View Full Version : Translation fieldlabel



Stephan123
25 Nov 2009, 7:15 AM
Hello !

In the moment i look for an way to translate the fieldlabe's of a form.
I have same languages a in the moment i know not how many.
I will send an Ajax.request to the server. The Server became the language and the
fieldlabel string. I became back the translated string.

My form:


xtype: 'textfield',
fieldLabel: SprachUebermittlung('E-Mail Adresse'),
name: 'email',
id: 'email',
width: 200,
vtype: 'email',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Passwort',
name: 'passwort',
id: 'passwort',
inputType: 'password',
width: 200,
allowBlank: false The Ajax script:




// return "New Label";

Ext.Ajax.request({
method: 'post',
url: 'kontroller.php',
params: {
aktion: 'sprache',
modul: 'sprache',
sprache: language, // the aktuell language
inhalt: wert // the string to translate
},
success: function(response){
var rueck = Ext.util.JSON.decode(response.responseText);

// console.dir(rueck);

// return rueck.sprache;

// console.warn('Sprachuebersetzung');

return rueck.sprache;

}
});

I have tested 2 version.

When i use the red version.
No label is in the form.

When i use the green version it works fine.

Wy ?????????? :((

Your sincerly

Stephan

realjax
25 Nov 2009, 7:46 AM
Little asynchronisity issue perhaps?

Stephan123
26 Nov 2009, 12:05 AM
Hello !

Thank for the info.
I think the problem is the asynchron Ajax.
On the client / browser the form is finishd and same time later
the translation for the fieldlabel came back.

In the moment i think about a other way.
I will generate an application on the server.
(With the correct translation).
And in a second step i will send the application to the server.

I have seen same interested projects on www.sourceforge.net

Your sincerly

Stephan