How to Customize Your GTranslate Language Switcher in the WordPress Menu
Content
Many WordPress users rely on the 'Translate WordPress with GTranslate' plugin to make their sites multilingual. A common area for customization is the language selector's placement and appearance within the site's navigation menu. Users often want to move it from a floating widget into the main menu bar or footer, change its design from a dropdown to a set of flags, or adjust its behavior. This guide covers the most frequent requests and their solutions based on community support threads.
Common Problems and Solutions
1. Adding the Language Switcher to the Menu Bar or Footer
Problem: The default floating language selector doesn't fit the site's design, and the user wants it fixed within the main menu or footer.
Solution: The primary method is to use a shortcode manually within your menu structure.
- Navigate to Appearance → Menus in your WordPress dashboard.
- Click on Custom Link.
- For the URL field, enter a hash symbol:
#. - For the Link Text field, enter the shortcode:
[gtranslate]. - Click Add to Menu and position the new menu item wherever you want the language switcher to appear.
This method uses the main [gtranslate] shortcode, which will display the language selector based on the "Widget look" you have chosen in the GTranslate settings. For more advanced positioning examples, the 'Translate WordPress with GTranslate' team suggests reviewing the "Positioning tips" section found on the plugin's settings page.
2. Changing from a Dropdown to Side-by-Side Flags
Problem: The language switcher appears as a dropdown menu, but the user wants all language flags to be visible side-by-side.
Solution: This issue is often caused by using the "Show in menu" configuration option, which automatically creates sub-menu items (a dropdown). To fix it:
- In the GTranslate settings, disable the Show in menu option.
- Follow the steps above to manually add the
[gtranslate]shortcode to your menu. This will render the flags horizontally.
3. Showing a "Select Language" Label Instead of the Current Language
Problem: The dropdown selector shows the name of the currently active language (e.g., "Dutch"), which some users find unclear. They prefer a static label like "Select Language."
Solution: There is no direct option in the plugin's interface for this. However, two workarounds are commonly suggested:
- Prepend Text: Modify the shortcode in your menu to read:
Select Language: [gtranslate]. This will place the text before the selector. - Advanced Code Edit: For the dropdown widget look, you can modify the
dropdown.jsfile. This involves finding and commenting out a specific line of code, but this is not recommended for most users as it can break during plugin updates.
4. Displaying Language Codes (e.g., EN, ES) Instead of Full Names
Problem: The user wants the selector to show concise language codes (EN, FR, DE) instead of the full language names (English, French, German).
Solution: The availability of this feature depends on the chosen "Widget look."
- Some widget styles, like "Flags with language code," have this option built-in. Check the widget looks available in the plugin settings.
- For other styles, like the "Float" widget, this option is not available. Achieving it would require directly modifying plugin JavaScript files (e.g.,
float.js), which is an advanced and unsupported procedure.
Important Considerations
- Caching: After making any changes to your menu or GTranslate settings, always clear your website's cache. A stubborn cache is a common reason why changes do not appear immediately.
- Theme Compatibility: Some themes use custom menu structures with unique CSS classes. If the language switcher dropdown does not appear correctly, it may be due to a conflict with your theme's styles. Consulting your theme's documentation or support is recommended in these cases.
- Cookie Blockers: If your site loses the selected language upon navigation, a cookie blocker or strict GDPR plugin might be interfering. The free version of GTranslate relies on cookies to remember the language choice.
By using these techniques, you can gain greater control over where and how your language switcher appears, ensuring it integrates seamlessly with your site's design.
Related Support Threads Support
-
Appear – Switch Languageshttps://wordpress.org/support/topic/appear-switch-languages/
-
Change menu link based on languagehttps://wordpress.org/support/topic/change-menu-link-based-on-language/
-
Setup simple flag (without dropdown)https://wordpress.org/support/topic/setup-simple-flag-without-dropdown/
-
set uphttps://wordpress.org/support/topic/set-up-63/
-
how to create dropdown language switcher instead of translate buttonhttps://wordpress.org/support/topic/how-to-create-dropdown-language-switcher-instead-of-translate-button/
-
How to remove Chinese language option?https://wordpress.org/support/topic/how-to-remove-chinese-language-option/
-
Languages in dropdown are not the choosenhttps://wordpress.org/support/topic/languages-in-dropdown-are-not-the-choosen/
-
How to place a dropdown Language Selector positioning at the left-bottom webpagehttps://wordpress.org/support/topic/how-to-place-a-dropdown-language-selector-positioning-at-the-left-bottom-webpage/
-
Selector should show ‘select language’ instead of active languagehttps://wordpress.org/support/topic/selector-should-show-select-language-instead-of-active-language/
-
Open by default in another language?https://wordpress.org/support/topic/open-by-default-in-another-language/
-
My language selector can’t be pinnedhttps://wordpress.org/support/topic/my-language-selector-cant-be-pinned/
-
Change Dropdownhttps://wordpress.org/support/topic/change-dropdown/
-
Default language wronghttps://wordpress.org/support/topic/default-language-wrong/
-
why is “Dutch” showing instead of “Select Language” on label?https://wordpress.org/support/topic/why-is-dutch-showing-instead-of-select-language-on-label/
-
How can I change the word Nederlands to NL?https://wordpress.org/support/topic/how-can-i-change-the-word-nederlands-to-nl/
-
Can’t change the language selector orderhttps://wordpress.org/support/topic/cant-change-the-language-selector-order/
-
Form returns to default languangehttps://wordpress.org/support/topic/form-returns-to-default-languange/
-
I want to show Indonesian option in dropdown but want to show English languagehttps://wordpress.org/support/topic/i-want-to-show-indonesian-option-in-dropdown-but-want-to-show-english-language/
-
selecting the language moves the column contenthttps://wordpress.org/support/topic/selecting-the-language-moves-the-column-content/
-
Menu Header shows three languageshttps://wordpress.org/support/topic/menu-header-shows-three-languages/
-
Even if I select the language codes option, I get a dropdown menuhttps://wordpress.org/support/topic/even-if-i-select-the-language-codes-option-i-get-a-dropdown-menu/
-
When another language is selected, it switches to English first for some time.https://wordpress.org/support/topic/when-another-language-is-selected-it-switches-to-english-first-for-some-time/
-
I don’t want a dropdownhttps://wordpress.org/support/topic/i-dont-want-a-dropdown/
-
Default language selection issuehttps://wordpress.org/support/topic/default-language-selection-issue/
-
Retour à la langue initiale lors de la navigationhttps://wordpress.org/support/topic/retour-a-la-langue-initiale-lors-de-la-navigation/
-
Me too, only one language showinghttps://wordpress.org/support/topic/me-too-only-one-language-showing/
-
Show all languages in menuhttps://wordpress.org/support/topic/show-all-languages-in-menu/
-
Wrong language indication.https://wordpress.org/support/topic/wrong-language-indication/
-
Change to acronymshttps://wordpress.org/support/topic/change-to-acronyms/