This script enables translation of Webflow pages using translation files hosted in a specified URL. It updates the page content dynamically based on the selected language.
- Fetches translations from a specified URL.
- Supports multiple languages.
- Updates text nodes and element attributes with translations.
- Provides a language selector dropdown.
-
Include the Script: Ensure the script is included in your HTML with
id="i18nWebflowScript"
. -
Translation Files: Host your translation files and add its url to the
translationUrl
parameter.
Example:
<script id="i18nWebflowScript" src="https://skydeckai.github.io/i18n/translate.js?translationUrl=https://skydeckai.github.io/i18n/translations/skydeck.json"></script>
- Language Selection: A language dropdown is automatically added, locating at the bottom left of the page. Use it to switch between supported languages.
- URL Parameter: The script uses the
lang
URL parameter to determine the current language. It updates the URL and page content accordingly.
- Use the i18n Webflow script to create translation files before deploying them with this script.