• Resolved suryamaya

    (@suryamaya)


    Hi there,

    I tried to implement the 4th approach from this link which is to create your own custom switcher. This has a javascript link. I followed that but didn’t work. Can you please advise how the structure of html for language switcher? How to add the below shortcode or code

    • a[href='#Weglot-xx']
    • a[href$='change-language.weglot.com/xx']

    Thank you in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Remy B

    (@remyb92)

    Hi,
    Thanks a lot for your message. I’m glad to help you out.
    The anchors (fake links) are only available on non-WordPress projects as they are working thanks to our LibJS.

    On WordPress projects, could you try adding the translated URL directly as “href” of the language link?
    For instance, for a Spanish translation, the link could be

    a[href='yourwebsite.com/es/']

    Repeat the process for all your languages links.

    NB: By doing this process, you’ll need to exclude the languages <a> tag from the translation to prevent Weglot to replace this link on the translated version. (See => https://support.weglot.com/article/95-how-to-exclude-urls-blocks-words-from-translation)

    Let me know if it works better this way.

    Keep me posted,

    Thread Starter suryamaya

    (@suryamaya)

    HI @remyb92

    Thank you for the response. We are actually using the wordpress plugin. We want language selected as drop down. In the dropdown full name should be displayed and when selected the respective country code should display. Please see the link for the screenshot.

    In the backend wp plugin has two locations to display the switcher, in the menu and in the footer (Default). We want to place the language switcher on the right side (at the right edge) of the page.

    Can you please advise how this can be managed?

    Thanks for your help.

    Plugin Author Remy B

    (@remyb92)

    Hi,

    Thanks for your message.

    As this is a custom language switcher, the help we could provide is pretty limited. It means that Weglot can not help further place the language switcher where you want.
    We advise working with our default language switcher and you’ll then be able to place it where you want on your website thanks to the processes as presented in our documentation below
    > https://support.weglot.com/article/348-wordpress-how-to-change-the-position-of-the-language-switcher

    Regarding the language code weglot_get_current_language() function that will return the language code of the current language. It means that if you click on the Spanish language, then the main language will display “es” thanks to the function above.
    Otherwise, I’d advise to maybe try with a custom JS code to dynamically replace the current language with the language code.

    Thread Starter suryamaya

    (@suryamaya)

    Hi @remyb92

    I think I found the way to manage it. You have helped me in that. Thank you again.
    We have three different sites that use this plugin and strangely one site doesn’t show the “Language button design option” but two sites have those settings. Please see the screenshot of no settings and with settings

    The one site has “Where will the language button be on my website? By default, bottom right.” and other two has different settings as in the second screenshot. When checked in Weglot there is no option to hide/display those settings.

    Are we missing anything for the first site that the options are not displaying?

    Regards

    Plugin Author Remy B

    (@remyb92)

    Hi,

    Thanks for your message.

    If you no longer see the settings it means that you could have try to work with our Switcher Editor feature into your Weglot Dashboard (see > https://support.weglot.com/article/349-how-to-use-the-switcher-editor).
    Could you contact us at [email protected] and provide us with the email address of your project so we can help you reset the switcher setup and help you further?

    Keep me posted

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Create own custom switcher’ is closed to new replies.