Can I use Weglot with a Single Page Application? (React, Angular, Vue.js...)
In this article, you'll learn how to use Weglot on your website if you're using a SPA (Single Page Application).
Note: This feature is not currently available on WordPress websites.
If your website is built with WordPress and uses a Single-Page Application, please email support@weglot.com for assistance.
What is a Single Page Application (SPA)?
A Single Page Application (SPA) is a type of web application implementation that dynamically generates content, often relying on frameworks like Angular, React, or Vue.js. Due to the dynamic nature of SPAs, certain content may not be present in the source code. Therefore, for Weglot to display the translations properly, a page refresh needs to be simulated.
Steps to translate your website if you're using a SPA:
- Head over to your Weglot Dashboard, then, under the Settings section, navigate to App Settings.
- Click on the "Add Dynamic" button
- Add the code "body" so that Weglot can refresh the content and correctly display your translations
- Finally, click on "Save".
Once this is done, you can Hard-Refresh* your website's page and check back in an incognito window, and your content should be translated.
*Hard-Refresh:
Mac: cmd shift R (lowercase)
PC: ctrl F5