Multi language web page

I know, I know, there are plenty information about this, but anyway, I would like to make this topic.

I want to create multilanguage site, just with two languages, I would like to have this page by default in Latvian, only when site visitors choose to switch to English, only then page will be translated. The way Im going to accomplish this is to use buttons instead of using menu. I made two datasets where one keeps information of button names and links to specific page. For LV those will be pages in Latvian, but for Eng those will be LV pages duplicates, that has information in English. Here goes few of my questions (actually Im looking for code snippets )- the first thing-how to achieve that page by default stays in latvian, what code I need to add for ENG button?

Thank you in advance!

I was thinking, is there any option to create two language buttons, that has onClick event. And when the event occurs, it connects to proper dataset, and those buttons change their value, that is stored as button names and correct links to the pages?

import wixData from ‘wix-data’;
export function EngButton_onClick(event) {
wixData.query(“engTransl”)
.find()
.then((results) => {
englishVersion = results.items;
})
.catch((err) => {
let errorMsg = err;
});
$w( [#c](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23text52?ref=producthunt&uaToken=JWE.eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiTXo2aHhUdVcifQ.tN668xHQT0kmHSmqNgHZsnLGaRK4OpZ0xZ9emv7MEpvlQCH2wZEFrA.6V7tdMNV37qhhZehy_YcCA.X1fJA3pQmNZefFFY3eOmIwgi46822NPWVvYXyFn28ikI_XKFt-MucwT-KR3w4JJ76j75FRxXa97OBAs1Pfgwj8p7t-XQVP4b5-a_WKFWEUW2YbN9yzrDmRSTBZk0jJbyo91M0l2241eUfIvUynA9keIXvJReMhxf5ceiAMl3nww.Ial_n-zYJZyGoK2OmJlAMA%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F/) oncertButton).label = itemData.concertB;
$w( [#](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23text52?ref=producthunt&uaToken=JWE.eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiTXo2aHhUdVcifQ.tN668xHQT0kmHSmqNgHZsnLGaRK4OpZ0xZ9emv7MEpvlQCH2wZEFrA.6V7tdMNV37qhhZehy_YcCA.X1fJA3pQmNZefFFY3eOmIwgi46822NPWVvYXyFn28ikI_XKFt-MucwT-KR3w4JJ76j75FRxXa97OBAs1Pfgwj8p7t-XQVP4b5-a_WKFWEUW2YbN9yzrDmRSTBZk0jJbyo91M0l2241eUfIvUynA9keIXvJReMhxf5ceiAMl3nww.Ial_n-zYJZyGoK2OmJlAMA%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F/) newsButton).label = itemData.newsB; $w( # contactButton).label = itemData.ContactB;
$w( [#](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23text52?ref=producthunt&uaToken=JWE.eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiTXo2aHhUdVcifQ.tN668xHQT0kmHSmqNgHZsnLGaRK4OpZ0xZ9emv7MEpvlQCH2wZEFrA.6V7tdMNV37qhhZehy_YcCA.X1fJA3pQmNZefFFY3eOmIwgi46822NPWVvYXyFn28ikI_XKFt-MucwT-KR3w4JJ76j75FRxXa97OBAs1Pfgwj8p7t-XQVP4b5-a_WKFWEUW2YbN9yzrDmRSTBZk0jJbyo91M0l2241eUfIvUynA9keIXvJReMhxf5ceiAMl3nww.Ial_n-zYJZyGoK2OmJlAMA%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F/) aboutButton).label = itemData.aboutB; $w( #c oncertButton).link = itemData.concertBLink; $w( # newsButton).link = itemData.newsBLink;
$w( [#](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23text52?ref=producthunt&uaToken=JWE.eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiTXo2aHhUdVcifQ.tN668xHQT0kmHSmqNgHZsnLGaRK4OpZ0xZ9emv7MEpvlQCH2wZEFrA.6V7tdMNV37qhhZehy_YcCA.X1fJA3pQmNZefFFY3eOmIwgi46822NPWVvYXyFn28ikI_XKFt-MucwT-KR3w4JJ76j75FRxXa97OBAs1Pfgwj8p7t-XQVP4b5-a_WKFWEUW2YbN9yzrDmRSTBZk0jJbyo91M0l2241eUfIvUynA9keIXvJReMhxf5ceiAMl3nww.Ial_n-zYJZyGoK2OmJlAMA%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F/) contactButton).link = itemData.ContactBLink; $w( # aboutButton).link= itemData.aboutBLink;

}

Could anyone comment this code and help me out?

Hi guys,
I recommend checking out this thread regarding the same question.

Have a good day,
Tal.

@ Tal I was aware of this thread, but could you help me a little bit out, and at least insert comments in your code, because I would like to build a similar architecture and I want to understand a bit more your code. Thank you in advance!

Hi,
Can you please specify which of the code snippets you don’t understand? Which of the steps are unclear?

Thanks,
Takl.