Here is how you can do it:
Code:
var myLabel;
// This should be located inside a function that is run after the JS code is loaded by XC5
if (!myLabel) {
myLabel = core.t('My text');
}
// Now myLabel contains the translation retrieved through an asynchronous request
However, the code above should be called after XC5 loads its JS core (otherwise the "core" will be unassigned). For example, you can put this code into your JS object extended from AController, that you load via core.autoload() function (see the source code for examples).