This issue is coming from the way the theme handles and filters HTML.
While WPML provides the language switcher it is the theme that renders and displays it in the header and menu.
The reason the WPML language switcher is showing raw HTML (for example <span> tags) when hovering over menu items is due to a behavior in the theme’s mega-menu walker. The walker incorrectly injects the full menu title—including WPML’s HTML markup—into the HTML title attribute of the menu link.
This is not a WPML problem. It comes from the way the theme’s menu walker handles menu item attributes.
The recommended next steps are to contact your theme developers as they can resolve this from their side by adjusting the code.
The problematic code is in :
ova-megamenu/inc/class-process.php
class Ova_Megamenu_Walker_Nav_Menu extends Walker_Nav_Menu {
Inside its start_el() method is the problematic line:
$atts['title'] = ! empty( trim( $item->attr_title ) ) ? $item->attr_title : $item->title;
Another option you can try as a workaround is to add the following code in
your child theme's functions.php
add_filter( 'nav_menu_link_attributes', function( $atts, $item, $args, $depth ) {
if ( ! empty( $item->classes ) ) {
foreach ( $item->classes as $class ) {
if ( strpos( $class, 'wpml-ls' ) !== false ) {
// Remove the title attribute for WPML switcher items
$atts['title'] = '';
break;
}
}
}
return $atts;
}, 20, 4 );
IMPORTANT NOTE: If you attempt this please note that we have not fully tested the code and it's simply a workaround, the proper fix should come from the theme developers.
Also before implementing any code changes provided by our team you should always have a working backup in place.