Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m wondering why you made this

    $wpo_wcpdf->get_woocommerce_totals()

    in the invoice template dependent on the wc textdomain.

    The problem is that this part of the invoice is translated to the
    admin user language.

    jon, we need some more infomation to resolve this.

    what are your exact polylang url settings ? check your static front page (wordpress => setting => reading). make sure the albanian home page is selected.

    best, jayhall

    Thread Starter jayhall

    (@jayhall)

    after looking into
    /wp-content/plugins/polylang/frontend/choose-lang-content.php
    and
    /wp-content/plugins/polylang/frontend/choose-lang-content.php

    if found the solution by setting the preferred language (if not the default language) a second time based on the pll_language cookie value.

    Luckily the author has provided a filter hook:

    
    function bs_set_preferred_lang_by_cookie($lang) {
    	if (isset($_COOKIE['pll_language'])) {
    		if($_COOKIE['pll_language']=='en'){
    			global $polylang;
    			$lang = $polylang->get_preferred_language();
    		}
        }
        return $lang;
    }
    add_filter('pll_get_current_language', 'bs_set_preferred_lang_by_cookie');
    

    If you opt for “set language by content” and don’t want to translate / synchronize identical categories and posts (like me) then this seems to be the way to go. I haven’t tried it yet but theoretically this should work, even if your content doesn’t have assigned any language at all.

    The drawback of my solution is that when i itend to switch back to the default language, i have to go back to the home page in order to reset the preferred language.

    Hi, here are just a few thoughts on this:

    – what is your PLL url modification setting ? Remember, when you choose “by content”, the language is determined by content. Post all *PLL* settings here !
    – are there translations of the homepage for *all* languages ?
    – switch temporarily to an uncostomized theme and check the behaviour again.
    – check your browser PLL language cookie and delete it before you hit the page initially.

    regards, jayhall

    Hi Pierre,
    does this plugin work for WooCommerce Categories and posts (Products)
    as well ? Or only for pages ?
    What does your polylang url settings look like ? Set language by content
    or by url ?
    thanks

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