• Resolved thaflo

    (@thaflo)


    Dear team,

    I would like to realize a language switcher like the one on the top right of the site this post links to.

    I do not want to have dropdown menu, as I have only 2 languages to switch between.
    If DE is active, IT should be shown, and if IT is active, DE should be shown.
    My current status is visible on: https://www.thaler-online.com/ig-new/
    How could I achieve this?
    Thanks for any help.

    Florian

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Dragos

    (@dragosvrejiu)

    Hello Florian,

    Thank you for getting in touch!

    We have a step by step documentation on how to achieve this:https://translatepress.com/docs/developers/show-opposite-language-in-language-switcher/

    Please let me know if you come across any issues.

    With the best regards,

    Thread Starter thaflo

    (@thaflo)

    Thank you so much, I did the solution without the plugin and it worked flawlessy.
    Have a nice day!
    Florian

    Plugin Support Dragos

    (@dragosvrejiu)

    Hello Florian,

    Thank you for letting me know!

    Good luck with your project.

    With the best regards,

    Dear Dragos or colleague,

    Just like Florian, I want to hide the active language flag in the menu of my 2 languages website (nl_NL and en_US). So I tried as explained on https://translatepress.com/docs/developers/show-opposite-language-in-language-switcher/.

    CSS Classes is checked, but I don’t know how to correctly edit my language menu items, adding a custom class. After adding the language switcher items to the menu, these CSS fields automatically contain: “trp-language-switcher-container”. I tried adding tp_nl and tp_en (like: “trp-language-switcher-container-tp-en”) but this doesn’t work.

    => How/where should I add tp_en and tp_nl in order to make this work?

    FYI: under Extra CSS I added:
    .translatepress-en_US .tp_en,
    .translatepress-nl_NL .tp_nl
    { display: none; }

    Thank you so much for your help, I’m really struggling with this

    Thread Starter thaflo

    (@thaflo)

    Hello rhpg!
    In the menus “CSS Classes” you have to insert like this: “trp-language-switcher-container tp_it”
    Adding means here to add the css class, not to attach something to the first class.
    So try “trp-language-switcher-container tp-en” instead of “trp-language-switcher-container-tp-en”

    Greetings,
    Florian

    Dear Florian, Dragos or colleague,

    I added tp-en resp. tp-nl as suggested in CSS Class field of the language switcher menu items, and added the following code in the Extra CSS:

    .translatepress-en_US .tp_en,
    .translatepress-nl_NL .tp_nl
    { display: none; }

    However, both flags remain visible. Something strange is happening in the CSS Class fields in the language switcher menu items:

    If I enter:
    trp-language-switcher-container tp_nl
    and close and re-open this field, it then says:
    trp-language-switcher-container tp_nl trp-language-switcher-container

    If I close and re-open again it says:
    trp-language-switcher-container tp_nl trp-language-switcher-container trp-language-switcher-container”

    So for some reason it keeps on adding “trp-language-switcher-container”. For testing purposes, I cleared these CSS Class fields in the menu and then only entered “tp-en”. If I close and re-open the field, it then says: “tp-en trp-language-switcher-container”

    I also had my website hosting provider look into this issue. He also followed the steps on https://translatepress.com/docs/developers/show-opposite-language-in-language-switcher/ but with the same outcome. They suspect that the code may be outdated.

    Can you please look into what the problem is? Or better: the solution!?

    Many thanks.

    Kind regards,
    Rob

    • This reply was modified 4 years, 3 months ago by rhpg.
    Thread Starter thaflo

    (@thaflo)

    Hi Rob,

    yes, I have additional CSS classes in my CSS field, too. but nevertheless, it works here.
    Maybe we have different preferences in Plugins->TranslatePress?
    This are mine: https://i.imgur.com/X35Mxxp.png

    I added

    .translatepress-it_IT .tp_it, 
    .translatepress-de_DE .tp_de
    { display: none; }

    in the Design/Customizer/CSS field

    Florian

    Thank you FLorian for sharing your thoughts and screenshot. My preference settings were the same, except that I had flags instead of short names. Changing according to your settings didn’t help unfortunately. Also, our Extra CSS code is the same.

    Maybe there’s something wrong in my menu settings. Here I have 2 Language Switcher elements with (initially) the following settings:

    1:
    Label: Dutch
    CSS Class: trp-language-switcher-container tp_nl

    2:
    Label: English
    CSS Class: trp-language-switcher-container tp_en

    (this is what I enter, as explained the system ads to these CSS Class codes itself)

    Are these Menu elements and CSS Class entries the same as yours?

    Many thank for your help!

    Kind regards,
    Rob

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide active language’ is closed to new replies.