Support » Plugins » [Plugin: Polylang] Flags vs. Text Links in widget

  • Hi Chouby,
    I’m testing all the multilingual features of WP with theme 20/11 and your plugin is the first that works completely, including links between pages, posts, categories and in the menues. Thanks a lot for this perfect solution where the user is still master over every detail.
    I have a request for the wish-list: would it be possible to show the language switcher as flags in the sidebar widget?

Viewing 15 replies - 1 through 15 (of 35 total)
  • It’s on my roadmap, either in v0.4 or in v0.5 depending on the date I will release the v0.4

    Thread Starter Christian Ries


    Thank you Chouby for your fast reply.

    Finally I included it in v0.4

    Thread Starter Christian Ries


    Thank you Chouby, but it works only partly (see as a temporary example) and I didn’t find a place where to switch between text / flags / flags & text…
    But maybe I made some mistake.

    there is error in polylang.php, function the_languages

    '<li class="'.$class.'"><a href="'.$url.'">'.($show_flags && $show_names ? $flag.'&nbsp;'.$name : $flag.$name)."</a></li>\n";

    flags shows even when you set doesn’t to show.
    must be:

    '<li class="'.$class.'"><a href="'.$url.'">'.($show_flags && $show_names ? $flag.'&nbsp;'.$name : $name)."</a></li>\n";

    dropdown list doesn’t switch languages. to options tag value we can add url and to select tag js-redirect to onchange event:

    $output = $dropdown ? '<select name="lang_choice" id="lang_choice" onchange="window.location.href=this.options[this.selectedIndex].value">' : "<ul>\n";
    					"<option value='%s'%s>%s</option>\n",
    					$language->slug == $this->curlang->slug ? ' selected="selected"' : '',
    					$name // FIXME flag does not work for the dropdown list
    				) :

    so with this 3 little bugfixes code should looks like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    so with this 3 little bugfixes code should looks like this:

    full code here –

    Thank you for your feedback.

    I will correct the flags issue in the future release.

    For the dropdown list, I guess that you use directly the function ‘the_language’ and not the widget. The javascript is included in the widget and intentionally not in the ‘the_language’ function, just as it is done in WordPress with the categories widget and the ‘wp_dropdown_categories’ function. I suppose that the widget is for users that want something ready to use and the function is for users that want more flexibility but are ready to write some code. Maybe I will do something different in the future to improve this (with an additional option in the function ?).

    Now that it’s corrected the flag thing, how do I configurate if I don’t have any clue? 😛

    The problem detected by yoyurec was that flags were displayed even if the language switcher was requested not to show them. It is solved now.

    What do you want to do ?

    I want to turn on the flags, where I have to upload the images for the flags? which name have they to have? any concrete size or as I prefer? How they will appear? In front of the text? Can I put them in a line instead of in a row? 😛

    I wrote some things about that in the documentation that you can find in the “polylang/doc” directory.

    To turn on the flags, just check the “display flag” option in the widget. You may want to check or uncheck the “display name” option. To use custom flags, just upload them in “polylang/local_flags” directory. You must name them en_US.png or en_US.jpg (or the appropriate locale for other languages). The size is yours. The html code outpusts the flag before the name.

    The way they are displayed (in a line or in a row) is just set by your css rules. You can play with .lang-item {display: inline;} or other css rules on the same class to modify the appearance

    Where I find .lang-item {display: inline;}? :$

    if you check you will see the icons for the languages, and I would want to put that in line one after other without anything else than images.

    I intentionally did not set any css rule (for frontend) in the plugin. It’s up to the theme to do that.

    You can write this line for example at the bottom of your file style.css in your theme.

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘[Plugin: Polylang] Flags vs. Text Links in widget’ is closed to new replies.