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}); }
Then when building the DOM
aHomeA.appendChild( document.createTextNode("Home"));
becomes:
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
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
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] 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});
} Then when building the DOM aHomeA.appendChild( document.createTextNode("Home")); becomes:
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 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |