Did you know you can support multiple languages in Studio with a single qr code? That’s right, you don’t need to publish multiple experiences for this.
We are going to use the navigator.language api. Usually you can’t access any useful web api in Zapworks Studio because the app lives in a sandboxed iframe. Any attempt to access anything is usually blocked. Fortunately, however, the navigator.language api slips through the cracks of the sandbox.
So, how can we use it? If you type “navigator.language” in a script node you will get this message
and that’s because the typescript definition Studio uses doesn’t include web apis (or most of them anyways), even though they exist, and can be used!(when not blocked by the annoying sandbox). To get around this issue and essentially tell typescript to shut up and let you do what you wanna do because you know what you’re doing, use this line
declare const navigator;
Now you can call
navigator.language and get one of the language codes. The language code that is being used by the browser. With this, you can parse the result and use it to have different text based on the language of the browser.
See the attached zpp, use it as a subsymbol for localized text nodes! localizedText_cleaned.zpp (184.3 KB)