View Single Post
  #3  
Old 08-31-2016, 01:22 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Using Translation Labels in JavsScript

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).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote