WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Polylang] Flags vs. Text Links in widget (36 posts)

  1. Christian Ries
    Member
    Posted 2 years ago #

    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?

  2. Chouby
    Member
    Posted 2 years ago #

    It's on my roadmap, either in v0.4 or in v0.5 depending on the date I will release the v0.4

  3. Christian Ries
    Member
    Posted 2 years ago #

    Thank you Chouby for your fast reply.

  4. Chouby
    Member
    Posted 2 years ago #

    Finally I included it in v0.4

  5. Christian Ries
    Member
    Posted 2 years ago #

    Thank you Chouby, but it works only partly (see http://byfoot.eu/bivels-lu/?page_id=29 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.

  6. yoyurec
    Member
    Posted 2 years ago #

    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";

  7. yoyurec
    Member
    Posted 2 years ago #

    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";
    sprintf(
    					"<option value='%s'%s>%s</option>\n",
    					$url,
    					$language->slug == $this->curlang->slug ? ' selected="selected"' : '',
    					$name // FIXME flag does not work for the dropdown list
    				) :
  8. yoyurec
    Member
    Posted 2 years ago #

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

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

  9. yoyurec
    Member
    Posted 2 years ago #

    so with this 3 little bugfixes code should looks like this:
    [....]

    full code here - http://pastebin.com/qtdS5hqd

  10. Chouby
    Member
    Posted 2 years ago #

    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 ?).

  11. The Crazy Travel
    Member
    Posted 2 years ago #

    Now that it's corrected the flag thing, how do I configurate if I don't have any clue? :-P

  12. Chouby
    Member
    Posted 2 years ago #

    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 ?

  13. The Crazy Travel
    Member
    Posted 2 years ago #

    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? :-P

  14. Chouby
    Member
    Posted 2 years ago #

    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

  15. The Crazy Travel
    Member
    Posted 2 years ago #

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

    if you check miesquinica.com 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.

  16. Chouby
    Member
    Posted 2 years ago #

    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.

  17. The Crazy Travel
    Member
    Posted 2 years ago #

    I don't know about css, I can modify what it's already written, but I don't know the codes, could you write one example line about that, please?

  18. The Crazy Travel
    Member
    Posted 2 years ago #

    I open another post for another topic.

  19. Chouby
    Member
    Posted 2 years ago #

    Well it will be difficult for you to get the exact appearance you want if you know nothing to css. The code I gave you, written in the style.css file of your theme will display your flags inline.

  20. The Crazy Travel
    Member
    Posted 2 years ago #

    Thanks! I did it and it works, the only thing would be to take out those arrows of the list. :$

  21. Chouby
    Member
    Posted 2 years ago #

    It's not Polylang support but you are a lucky guy (and say thank you to a wonderful Firefox extension called Firebug which allowed me to look at your css !!!)

    Replace the line .lang-item {display: inline;}
    by

    #sidebar ul ul li.lang-item {
      background-image: none;
      display: inline;
    }
  22. The Crazy Travel
    Member
    Posted 2 years ago #

    Thanks a lot! :$$$

    Unfortunatly seems like in my sidebar doesn't feet the three flags in a line, and it's not because of the size of the pngs. Any last clue to fix it? :$

  23. Chouby
    Member
    Posted 2 years ago #

    The 3 flags are OK on my browser. Only your title is too big. Try setting the font size at 18px at line 117

  24. The Crazy Travel
    Member
    Posted 2 years ago #

    I see it depends on the browser, with Firefox it's ok, with Chrome the third one goes to a second line and with safari it appears still in a row.

    About the text I am taking it out now, I will leave it without text.

  25. Chouby
    Member
    Posted 2 years ago #

    You are discovering the headaches of web designers...

  26. The Crazy Travel
    Member
    Posted 2 years ago #

    haha, I see, fucking browsers that doesn't follow the standards? :-P

  27. Chouby
    Member
    Posted 2 years ago #

    Fortunately IE6 and IE7 are slowly dying but no browser is perfect, not even Firefox or Chrome.

  28. Pompatzis
    Member
    Posted 2 years ago #

    Hello Chouby, great plugin to begin with, very easy to use, very practical too..

    I only have a problem and i am not sure whether it is my issue or the plugins. To tell you the truth, it is probably, but i though maybe you came across it before.

    So to the problem. Everything works perfectly fine, besides showing the flags. I just can't see them even though i set the choice correctly. The plugin even creates the space for the flags but the flags are not shown. (seems like a permissions thing to me, but i even set the folders to 777 and still i cant see them).

    The weird part is that when i check it out with firebug, i don't even see an <img> tag. What i see is this:
    <li class="lang-item lang-item-20 menu-item">

    Any ideas?

    Thanx

  29. Pompatzis
    Member
    Posted 2 years ago #

    I actually found the problem and it was something in my configuration! Ignore my comment!

    Thanx

  30. SdeBie
    Member
    Posted 2 years ago #

    Fixed it.

Topic Closed

This topic has been closed to new replies.

About this Topic