• Resolved sdenec

    (@sdenec)


    Hello, I would like to know if it is possible to declare an alternative language name that is displayed in the frontend (via the language switcher menu). I would like to create a switcher that displays the language like “Willkommen zu”/”Welcome to”/”Bienvenue á” rather than “Deutsch”/”English”/”Francais”. I know it technically is possible by simply changing the display name, but it would also change the label in the Backend. Maybe there is a way to do a str_replace somewhere? I’m not an exepert programmer so any suggestions or help would be much appreciated. Thanks in advance.

    https://wordpress.org/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    That’s indeed possible with some str_replace thanks to the ‘pll_the_languages’ filter:

    add_filter( 'pll_the_languages', 'modify_switcher' );
    function modify_switcher( $switcher ) {
      // you can modify the $switcher with some str_replace here.
      return $switcher;
    }
    Thread Starter sdenec

    (@sdenec)

    That is perfect! Thank you for your quick help.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Polylang custom Language Switcher names’ is closed to new replies.