Dear All,
I have a multi-language website in English and Spanish.
On the page I have a button to allow users to download an Excel file.
I created a collection to check what files have been downloaded and by what user, but I also need to know in which language (EN or ES).
I typed the code as following but I encountered a “Parsing Error: Unexpected token $W”
let user = wixUsers.currentUser;
let userEmail;
user.getEmail()
.then((email) => {
userEmail = email;
});
export function DownloadDoc_click(event) {
let userId = user.id;
let isLoggedIn = user.loggedIn;
let userRole = user.role;
let toInsert = {
“userId”: userId,
“userEmail”: userEmail,
“userRole”: userRole,
“docDownloaded”: “Countries”
$w.onReady( () => {
if (wixWindow.multilingual.currentLanguage === “en”) {“language”: “EN”;}
else if (wixWindow.multilingual.currentLanguage === “es”) {“language”: “ES”;}
})
};
wixData.insert(“myCollection”, toInsert)
.then((results) => {
let item = results;
})
. catch ((err) => {
let errorMsg = err;
});
}
Thank you for your help.
Best regards,
Domivax