Thank you for your reply, AmandaM!
I adjusted my code according to your suggestion but it did not change the language in the table heading. The code was running fine, no errors in the log. I think the way the header text was assigned in the last line was the problem.
After some trial and error I achieved the functionality I wanted using this code:
let language = wixWindow.multilingual.currentLanguage
let header1 = $w ( “#table1” ). columns [ 0 ]. label
let header2 = $w ( “#table1” ). columns [ 1 ]. label
let header3 = $w ( “#table1” ). columns [ 2 ]. label
let header4 = $w ( “#table1” ). columns [ 3 ]. label
if ( language == “en” ) {
header1 = “Price period”
header2 = “Weekly price”
header3 = “Daily price for 7 days or more”
header4 = “Daily price for less than 7 days (minimum 2 days)”
}
else if ( language == “de” ) {
header1 = “Preise im Zeitraum”
header2 = “Wochenpreis”
header3 = “Tagespreis für 7 Tage und mehr”
header4 = “Tagespreis für weniger als 7 Tage (minimum 2 Tage)”
}
$w ( “#table1” ). columns = [
{
“id” : “col1” ,
“dataPath” : “prisperiode” ,
“label” : header1 ,
“type” : “string”
},
{
“id” : “col2” ,
“dataPath” : “vekespris” ,
“label” : header2 ,
“type” : “string”
},
{
“id” : “col3” ,
“dataPath” : “dagprisForMeirEnn7Dagar” ,
“label” : header3 ,
“type” : “string”
},
{
“id” : “col4” ,
“dataPath” : “dagprisForMindreEnn7DagarMinimum2Dagar” ,
“label” : header4 ,
“type” : “string”
}
]
I don’t think this is the most elegant way of doing it (by redefining the column arrays at the end) but it works for now. This solution allows me to only use one single collection for all three languages.
And yes: I strongly agree that multilingual collection tables should be an OOTB feature and I have now submitted my vote for this.