Language switchers
How to add language switcher
To add a language switcher, first navigate to the Settings menu for your project. Then, click on Language switcher. Use the menus to customize the language switcher to your liking. Make sure to check off "Auto-select language based on visitor's browser settings" if you want language auto-selection. Then, click Copy code snippet in the bottom right. Now, you'll embed the code on your website.
How to embed the language switcher for Webflow:
Visit the 'Settings' > 'Custom code' tab.
Paste the lanuage switcher code snippet in the 'Footer code' section.
Click 'Save', then 'Publish'.
Refer to the Webflow documentation for more details.
How to embed the language switcher for Framer:
Visit the 'Site Settings' > 'General' tab.
Scroll down to the 'Custom Code' section.
Paste the lanuage switcher code snippet in the 'End of <head> tag' section.
Click 'Save', then 'Publish'.
Refer to the Framer documentation for more details.
How to embed the language switcher for Carrd:
Open your project, click '+ Add Element'.
Select 'Embed'.
Set the 'Style' to 'Hidden' and paste the language switcher code snippet in the 'Code' section.
Click 'Done' and publish your site.
Refer to the Carrd documentation for more details.
How to embed the language switcher for Wix:
Go to 'Settings' in your site's dashboard.
Click on 'Custom Code' in the 'Advanced' section.
Click '+ Add Custom Code' at the top right.
Paste the language switcher code snippet.
Select 'Load code on each new page' and click 'Apply'.
Refer to the Wix documentation for more details.
Finally, go back to Linguana, and click Sync content, then Publish. Now your language switcher should be live on your site.
Basic language switcher code
Language switcher customization options
LINGUANA_MAIN_LANGUAGE_CODE: This represents the original language that your website was written in, such as "fr" for French, "de" for German, or "en" for English. By default, it is set to "en".
LINGUANA_DEFAULT_LANGUAGE_CODE: This represents the default language that you would like the website to display to new visitors, such as "fr" for French, "de" for German, or "en" for English.
LINGUANA_AUTO_DETECT_LANGUAGE: Set this to true to automatically detect and select the visitor's language based on their browser settings. If their preferred language is not available, the main language will be selected. This will have preference over the default language setting.
LINGUANA_SWITCH_CUSTOM_CONTAINER_ID: This is used for completely customizing the language switcher. Add this variable and create an element wrapper with the specified ID. The script will then render the switcher in that location. If you use this, it is advisable to avoid using Linguana's CSS and create your own custom CSS instead.
LINGUANA_SWITCH_TOGGLE_BUTTON_ID: This specifies the ID of the toggle button. If you change this ID, you will need to provide your own CSS for styling the button.
LINGUANA_OPTIONS_CONTAINER_ID: This defines the ID of the wrapper div that contains the language link options.
LINGUANA_SINGLE_OPTION_CLASS: This specifies the class for a single option container within the language switcher.
LINGUANA_SINGLE_OPTION_FLAG_CONTAINER_CLASS: This represents the class of the element that contains the flag icon for each language option.
LINGUANA_SINGLE_OPTION_LABEL_CONTAINER_CLASS: This specifies the class of the element that contains the label for each language option, such as "en" for English.
LINGUANA_SHOW_LANGUAGE_CODE: Set this to true if you want to display the language code (e.g., "EN") on the label. If disabled, the label will not show the language code.
LINGUANA_SHOW_LANGUAGE_NAME: Enable this to display the language name (e.g., "English"). If both this and LINGUANA_SHOW_LANGUAGE_CODE are enabled, the label will show the language in the format: "English (EN)".
Styling the language switcher
You can style the language switcher by simply using CSS in your global footer code.
Last updated