Hi,
On my Wix-site I have a dataset connected table for displaying different prices for house rental according to the time of year and the number of days a customer want to rent a specific house:
This table is in Norwegian but my site is multilingual (Norwegian, English and German). I want to use some Velo-code to translate the table headings and the first (leftmost) column to English and German, depending on which language is chosen by the user.
I want to avoid creating a single dataset for each language. I am not familiar with JavaScript, but I have started some coding that may help show what I am trying to do:
import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;
$w . onReady ( function () {
**let** language = wixWindow.multilingual.currentLanguage ;
**if** ( language === "no" ) {
$w ( '#table1' ). rows [ 0 ][ "prisperiode" ] = "Prisperiode" ;
}
**else if** ( language === "en" ) {
$w ( '#table1' ). rows [ 0 ][ "prisperiode" ] = "Price period" ;
}
**else if** ( language === "de" ) {
$w ( '#table1' ). rows [ 0 ][ "prisperiode" ] = "Preise im Zeitraum" ;
}
})
I think this looks a bit hard coded. Maybe it is possible to change the content of the first row and the first column by using some sort of array?
Thanks!