• Tried to create a pull-request on Github, but got a notice that this was just a mirror.
    Couldn’t find an other way to do this, so I’ll post it here.

    I would like to see the following pulled into the plugin! ??

    Extended the language switcher to enable the “Current language first” option.
    Fount this to be very usefull in multiple projects so I thought I should share this.

    Edited:

    line 25: adding option 'current_first'
    line 81 - 89: change language orde if current_first option is enabled.

    TODO: String translation: “Current language first“.

    Dutch translation: “Toon huidige taal als eerste

    More info and pull request: https://github.com/wp-plugins/polylang/pull/1

    https://www.ads-software.com/plugins/polylang/

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

    (@chouby)

    Hi!

    It’s a bit specific. Using pll_the_languages with the ‘raw’ option would allow you to fully customize the language switcher without hacking the plugin.

    Thread Starter Jory Hogeveen

    (@keraweb)

    Hi Chouby,

    Thanks for the info! Though I disagree on the specific part. You see a lot of dropdown widgets for languages on the web, and the default select-dropdown display doesn’t support flags.
    When adding this as an option it’s really easy to make a css dropdown and at the same time show the user what language is selected. Seems to me like a basic option. And in my case almost a must-have.

    You sollution wil need to be applied on every theme you have while it’s a function that belongs to this specific plugin.

    Or am I missing something?

    Thanks again!

    Plugin Author Chouby

    (@chouby)

    Making a dropdown supporting flags requires some extra coding. Am I wrong?

    Thread Starter Jory Hogeveen

    (@keraweb)

    Nope. Just use the regular view (not dropdown) and use CSS to hide all flags except the first/current one.
    THis can be done with the current language not as first but it’s less ‘neat’.

    Thread Starter Jory Hogeveen

    (@keraweb)

    Example code:

    .widget_polylang li.lang-item {display: none;}
    .widget_polylang li.lang-item.current-lang {display: block;}
    .widget_polylang:hover li.lang-item {display: block;}

    With the option “current lang first” not available it will look like this:

    Normal:

    • English

    Hover: (depending on language order)

    • Dutch
    • German
    • English
    • French

    But with this option enabled it wil be more logical for a dropdown:

    Hover:

    • English
    • Dutch
    • German
    • French
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Update switcher.php to enable option "Current language first"’ is closed to new replies.