Hi, those strings are overrided by the terms in Quick Translation form (or the default ones in English).
The easiest way for you to show time units in your multilingual site is to ask Polylang plugin support about detecting currently used language and use the code in other thread.
Thread Starter
catheg
(@catheg)
Thx.
I opened a thread in the polylang support forum. No answer for now.
But what is strange, is that I have no problem using get_locale() or pll_current_language in the sidebar.php or in the footer.php or function.php of my theme.
It’s only in the translateTerms function that I can’t get the current language.
That’s strange. What does it return in the translateTerms function? Something other must be interfering with get_locale(). Try deactivating the Polylang plugin and check again.
Thread Starter
catheg
(@catheg)
If in the countdownTo function :
1) I call the get_locale() function the value returned is correct :
fr_FR when the polylang flag is set on french
en_EN when the polylang flag is set on English
2) I call the pll_current_language() polylang function, I don’t have the error “Call to undefined function pll_current_language()”
the value returned is correct to
fr when the polylang flag is set on french,
en when the polylang flag is set on English.
So I don’t understand why it doesn’t work in translateTerms function maybe because this function is called in the constructor of the class.
(the value returned by get_locale() is always the value defined on Setting-> general,
and pll_current_language() is undefined)
Any idea to fix this.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Side note to the author @pluginbuilders I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.
https://ww.wp.xz.cn/support/guidelines/#the-bad-stuff
Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.
If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.
Please be aware that repeatedly asking for credentials will result in us asking you to repeatedly stop before escalating up to the plugins team.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Another side note to @pluginbuilders You’ve been supporting your customers here and 6 months ago you were informed to not do that here again.
https://ww.wp.xz.cn/support/topic/paid-for-two-need-download-link/?view=all#post-9387096
Your account is now on moderation watch. No notifications will be sent for your replies and all of your replies and topics will need to be approved by a moderator before they can be seen by other users.
https://ww.wp.xz.cn/support/guidelines/#being-mod-watched-or-banned
Please correct your behavior. Do not ask for login access and do not support your customers here. If that is too burdensome then please consider removing your plugin from the WordPress repository.
Thread Starter
catheg
(@catheg)
Ok so sorry for what happens here.
I understand the security reasons.
Let’s try an other way.
You can easly reproduce the problem on a test site, and see that for now your plugin is not fully compatible with polylang.
Create a WP site for example with twenty Seventeen theme.
Install your plugin
Install polylang
Create 2 pages
Put a Waiting counter in the sidebar
Create 2 languages in Polylang (English, French)
Translate the 2 pages.
Create 2 menus, one for English, one for french with the pages, put the Polylang language switcher in each menu.
echo the get_locale() in the translateTerms function.
Switch the language with the switcher.
and you are going to see that get_locale() always returns the value of the WordPress General settings.