Appex and Language detection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Appex and Language detection

Maarten Mostert

Hi,

 

I would like some advise on how to deal with different languages in Appex.

 

What I did now is creating a the following function on the client side:

 

getMessage(selectorName) {

var response = this.messageToServer(selectorName, null, {async: false});
return response.object;

}

 

 

Then when building the DOM

 

aHomeA.appendChild( document.createTextNode("Home"));

 

becomes:


aHomeA.appendChild( document.createTextNode(this.getMessage("Home")));

 

 

This works however Chrome now gives me an error:

 

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

 

However if I set the messageToServer with async:true   it no longer works.

 

I also wonder if the next is actually fail safe over browsers  (IE <= 10):

 

(self htmlTokenMap at: #languageCode) value = 'fr'

 

 

Ultimately being able to use user messages in an elegant would be perfect.

 

Any advise is welcome

 

Regards,

 

Maarten MOSTERT

 

 

28 Av Alphonse Denis

83400 Hyères, France

+33 676411296 

http://stakepoint.com/

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Appex and Language detection

Degen, Vladimir

Hi Maarten,

 

Making an asynchronous request is considered much better practice (hence the warning from Chrome).

 

Since with an asynchronous call you are not pausing execution of the main thread to wait for a result from the server, you must use a callback to continue processing after your data is retrieved. 

 

Something like this:

 

var response = this.messageToServer(selectorName, null, {async: true});

response.onSuccess(function (data) {

               aHomeA.appendChild(document.createTextNode(data));

});

 

A couple of additional notes:

 

I’d recommend having the client fetch your string mappings up front in a single request rather than one at a time as needed.

This would probably simplify your code.

 

A “user String” framework which will probably fulfill your requirements is scheduled for inclusion in the 8.1 release.

 

Best,

Vlad

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Friday, April 3, 2015 7:31 AM
To: VWNC
Subject: [vwnc] Appex and Language detection

 

Hi,

 

I would like some advise on how to deal with different languages in Appex.

 

What I did now is creating a the following function on the client side:

 

getMessage(selectorName) {

var response = this.messageToServer(selectorName, null, {async: false});
return response.object;

}

 

 

Then when building the DOM

 

aHomeA.appendChild( document.createTextNode("Home"));

 

becomes:


aHomeA.appendChild( document.createTextNode(this.getMessage("Home")));

 

 

This works however Chrome now gives me an error:

 

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

 

However if I set the messageToServer with async:true   it no longer works.

 

I also wonder if the next is actually fail safe over browsers  (IE <= 10):

 

(self htmlTokenMap at: #languageCode) value = 'fr'

 

 

Ultimately being able to use user messages in an elegant would be perfect.

 

Any advise is welcome

 

Regards,

 

Maarten MOSTERT

 

http://stakepoint.com/images/LogoStakePointEmailSmall.png

 

28 Av Alphonse Denis

83400 Hyères, France

+33 676411296 

http://stakepoint.com/

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc