Language variable in javascript / multilanguage toggle button

Hello all,

I am stuck in my project with a question and hope somebody can help.
I had a toggle menu through javascript that was working for the static site so far. Now I am building the project in kirby with multilanguage and i discovered that i can use language variables to translate the menutoggle button. But i dont understand how to use the variable within the javascript? Or do i have to come up with a completely new way to toggle and does someone have a tip? Still fairly new to both PHP and JS but trying to learn it by doing. Thank you :slight_smile:


You can use data attributes in your HTML yo pass data from the backend to the frontend

thank you for pointing me into the right direction! I was googling around old forum entries with these keywords but something didnt click yet, it seems i need to put some more work in learning javascript to get how to reference data attributes in there. (For now I worked around it by having two links with two language variables displayed in turn through javascript)