Ce sujet est résolu. Voici une description du problème et de la solution.
Problem:
If you're experiencing issues with a widget that calls a block with a menu not consistently displaying in the correct language, with categories and titles appearing in different languages at different times.
Solution:
Solution 1:
First, ensure that the block is translated. Then, in the widgets section, try creating two widgets: one with the block ID for the French version in the shortcode (e.g., [block id="siderar"]) and set it to display only in French. Create another widget with the English translation shortcode and set it to display in English.
Solution 2:
If you prefer to use a single widget, follow these steps:
1. Note that the shortcodes are different for each language. For example, in French, it's [block id="filtre-siderar"] and in English, it's [block id="filtre-sidebar"].
2. The block itself contains shortcodes, such as [ux_menu_link text="• Lavande" term="103"].
3. To make your shortcodes translatable, add the following code to "WPML > Settings > Custom XML Configuration":
<wpml-config> <shortcodes> <shortcode> <tag>block</tag> <attributes> <attribute>id</attribute> </attributes> </shortcode> <shortcode> <tag>ux_menu_link</tag> <attributes> <attribute>text</attribute> <attribute>term</attribute> </attributes> </shortcode> </shortcodes> </wpml-config>
> This will make your shortcodes translatable.
4. In "Appearance > Widgets", instead of using a UX block widget and selecting the block, use a "Text" widget and add the shortcode [block id="filtre-siderar"].
> WPML will translate this shortcode to the English version.
5. For the [ux_menu_link text="• Lavande" term="103"] shortcode, the translation of the "text" attribute will now be considered, and you should see "Lavander". However, since the "term" attribute is a number, it won't be translatable in our editor, and your links will still point to the French category.
6. Go to "UX Blocks", switch to English, and edit the English version of this filter. Replace the category ID with the English category ID (e.g., replace 103 with 260 for the "lavender" category).
[ux_menu_link text="• Lavander" term="260"]
If this solution doesn't look relevant, please open a new support ticket.
Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.
Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum French. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
Ce sujet contient 6 réponses, a 2 voix.
Dernière mise à jour par Nicolas Viallet Il y a 2 mois et 4 semaines.
Assisté par: Nicolas Viallet.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.