pressidium / pressidium-cookie-consent

🍪 Lightweight, user-friendly and customizable cookie consent banner to help you comply with the EU GDPR cookie law and CCPA regulations.
https://wordpress.org/plugins/pressidium-cookie-consent/
GNU General Public License v2.0
48 stars 2 forks source link

How to translate: <html lang="de-CH"? Polylang Support? #27

Closed techpressrocks closed 1 year ago

techpressrocks commented 1 year ago

Hi! I find your plugin really promising, however, I do have some issues with language support. I would like to make it compatible with Polylang (https://wordpress.org/plugins/polylang/). I have created a language "Swiss German", that is "de-CH" for locale. Language code is: "de".

Unfortunately, it seems that your plugin expects <html lang="de" when it's actually "de_CH", the locale. At least that's what WordPress outputs inside the HTML tag. There are many "flavours" of German, and even if I set the proper German in WordPress, it will be "de_DE" not "de" that WP outputs in HTML.

Anyway, if I go to "Translations" and create "German" and use "document - Read value from of current page" it is not working. It's not showing any translation whether I switch to "de_CH" or "de_DE".

I've just done a test with a simple code like for Afrikaans that has "locale" and "code" both "af" and the translation showed up, so could you please make your plugin compatible to language codes like "xx_XX" not just "xx". Thank you!

Andy

over-engineer commented 1 year ago

Hey, @techpressrocks!

Thank you for your kind words and for spotting that issue! We appreciate you taking the time to report it.

The issue was fixed in 1.1.5, which was just released on the Plugin Directory.

Screenshot 2023-08-22 at 10 48 51@2x
techpressrocks commented 1 year ago

Thank you!

Now it only needs the second part:

That is the display of the saved inputs in the translations. As you can see at the following demo site it does display the simple attribute lang="af" if you select "Afrikaans" but the lang attributes with locale are not working yet:

lang="en-US" and lang="de-CH".

I'm sure all it needs is a small change in JS. Here the test site. The language switcher (which is created by Polylang) is in the upper right corner:

https://new.1daywebsite.ch/af/afrikaans-home/

over-engineer commented 1 year ago

Whoops! I accidentally used an underscore (_) instead of a hyphen (-) for the locales, so I was trying to detect de_CH instead of de-CH.

The issue was addressed in 1.1.6 (tested on an installation with the Polylang plugin), which was just released on the Plugin Directory.

Let me know if that fixed it for you 🙂

techpressrocks commented 1 year ago

Fantastic! I tested it just now. It's working Konstantinos!

Thank you so much! Andy