[Plugin: Cookie Compliance] Polylang compatible?
qTranslate compatible. Great, but… what about the new multi-lingual kid on the block, Polylang?
or wpml? WPML has a nice plugin string discovery and translation tool, but it does not work with your Cookie Compliance
Hi RavanH and Tegotha,
we are working on making the plugin compatible with other language plugins as well.
We will have a look into the Polylang and WPML plugins.
Anyone else any suggestions? Please let us know!
release 1.0.8 will be released today, it supports Polylang.
If you experience any troubles, please let us know.
OK, first quick test with Polylang shows me the ability to change the texts for each configured language. Great!
However, it also breaks my home page 🙁
I use a static homepage with the Showcase template in Twenty Eleven. The Polylang options
– “When using static front page, redirect the language page (example: http://status301.net/en/) to the front page in the right language”
– “When the front page is visited, set the language according to the browser preference”
– “Hide URL language information for default language”
But after accepting the cookie notice, the home page returns a 404…
an update was released tonight (version 1.0.10), this should fix the problem you experienced.
Can you check and let me know?
It does not seem to change anything. I tried resaving permalink structure and both plugin settings but still the 404 on all language homepages occurs…
ok, i will try to reproduce the error. I will let you know when we fixed it for sure 🙂
Ok, i could reproduce the error pretty easy.
Sorry i didnt see this before.
I added version 1.0.11 but didnt release it yet, could you try it?
It can be found here: http://downloads.wordpress.org/plugin/cookie-compliance.1.0.11.zip
Maybe I can help a bit…
But for this, I should understand the reason for you to instantiate a Polylang_Core object on admin side with:
require_once(PLL_INC.'/core.php'); $PolyLang = new Polylang_Core(); require_once(PLL_INC.'/api.php');
I have seen that you use it only for the function
get_current_languagewhich is available only on frontend. Are you doing this for AJAX?
In that case, setting $_REQUEST[‘pll_load_front’] in your AJAX request should load the frontend side of Polylang, and then you can use the global variable
$polylang. If you set $_REQUEST[‘lang’], Polylang will use it to set the language, otherwise it will use the preferred language (cookie or browser preference or default)
Edit: maybe my help is not needed anymore, if everything works
for the frontend using the
pll_current_language('slug')is enough, only need to know the current language.
But in the backend we need to know the list of available languages. I use the function
Indeed the problem was caused by initiating the Polylang_Core object, which was also initiated when on the frontend.
It does work ok at the moment, but when you see anything that could be improved or simplified. All info is always welcome 🙂
thanks for the check! I will put it in the release now.
Well, in fact, I don’t understand the lines:
$tmplang = get_object_vars($PolyLang->get_current_language()); self::$language = $tmplang['slug'];
get_current_languagehas some meaning only on frontend but you call it when is_admin == true (that’s why I thought you are doing this for AJAX).
Normally, it is not available on backend side (you can call it because you instantiated a “frontend” object of Polylang).
get_languages_list()is already available on both frontend and backend if you use the global object
ok, that makes sense…
i kinda just need to set a current or default language code in the backend when there is nothing chosen yet.
Maybe better if i just take the first language in the list when nothing is set… that should do…
gonna try that, it would reduce the code indeed…
- The topic ‘[Plugin: Cookie Compliance] Polylang compatible?’ is closed to new replies.