WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Untranslated taxonomies/custom taxonomies (5 posts)

  1. filip.jnc
    Member
    Posted 6 months ago #

    Hello Chouby,

    First of all, I've got to say that this plugins rocks! It's very light and user-friendly. I have only one issue that I reckon is not a big deal to hack/fix/add an option in the next version of Polylang.

    1. I'm using a static front page
    2. PLL settings
    3. Webpage: http://www.bikeportal.md
    4. Languages: Romanian(default)/Russian

    My problem is that in case of untranslated categories/posts, polylang language switcher doesn't show the link to that category/post but to the homepage. For example the category of posts Rezultate (Results) has not been translated and when you are in the default language and hover on the russian flag, you can see the url goes to the russian homepage (http://bikeportal.md/category/results/). The same goes for single posts.

    The thing is that I don't to translate these posts and I don't want to duplicate them either. So I thought if I translate categories and assign each post to 2 categories (default - translated), this post would appear in both romanian and russian posts list. Unfortunately, I can't assign one post to the counter-language category. If only that was possible, I think all problems on my website would be gone.

    Any advice on this problem? I would be very thankful.

    Kind regards,

    Filip

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

  2. filip.jnc
    Member
    Posted 6 months ago #

    PS. The code for my custom language switcher at the bottom of the page:

    <?php
    if( class_exists('Polylang') && function_exists('pll_the_languages') ) {
    
    $pll_args = array('show_names'=>0,'show_flags'=>1,'hide_if_empty'=>0,'hide_current'=>1,'raw'=>1);
    $pll_otherlang_array = pll_the_languages($pll_args);
    $pll_otherlang_details = $pll_otherlang_array[0];
    $pll_url = $pll_otherlang_details['url'];
    $pll_flag = $pll_otherlang_details['flag'];
    ?>
    <div class="mk-polylang-switcher">
    		<a href="<?php echo $pll_url ?>" class="mk-polylang-switcher-link"><?php echo $pll_flag ?></a>
    </div>
    <?php } ?>
  3. filip.jnc
    Member
    Posted 6 months ago #

    I've just noticed that if I add ?lang=ru at the end of the URL of each post or custom-post, the post is still displayed in the Romanian (default) and the rest is in Russian (even though the post in not translated). This is close to what I want if the post is not translated.

    Demo:
    http://bikeportal.md/results-2013-1/
    http://bikeportal.md/results-2013-1/?lang=ru

    However, this doesn't work with categories and other taxonomies + the switcher still wants to redirect me to the homepage (doesn't add ?lang=ru in the href).
    __________________________
    This still has little-to-nothing to do with my main problem: the translated categories and other taxonomies are empty because I can't assign untranslated posts to them.

    Demo:
    http://bikeportal.md/category/results/
    http://bikeportal.md/category/results-ru/
    -> As you can see, the second one is a translated category of posts and it's empty -> thus the language switcher from default language sees it and doesn't add the correct URL to the Russian category.

    Any suggestions, tips, codes, idea would be very appreciated! I really don't want to switch to that heavy WPML...

  4. filip.jnc
    Member
    Posted 6 months ago #

    I changed some bits of code in this plugin to redirect me to ?lang=ru of the same article if no translation is found and query the default article. It's not a permanent fix, but I hope Polylang gets the future of displaying default category lists/posts/whatever if no translation found. Cheers.

  5. erpaolett
    Member
    Posted 3 months ago #

    Hi Chouby, i agree with filip ... this feature should be very helpful.
    Any plans to update your plugin, to manage this situation in a cleaner way?

    Filip ... could you share your code modifications?

    thanks, this plugin rocks!
    Paolo

Reply

You must log in to post.

About this Plugin

About this Topic

Tags