Currently you need to automatically let Cookiebot detect your language, but there is the data-culture option to force the language from the script tag.
It would be great if we can let Drupal tell Cookiebot which language to use.

Comments

dmsmidt created an issue. See original summary.

arnested’s picture

Status: Active » Needs review
StatusFileSize
new2.04 KB
c960657’s picture

+      '#description' => $this->t('Use Drupal language for the cookie popup. If not set Cookibot will autodetect the language from the users browser.'),

Typo:

  • Cookibot → Cookiebot
  • users → user's
arnested’s picture

StatusFileSize
new2.05 KB

Thank you, Christian (long time no see)!

Fixed patch uploaded.

a.milkovsky’s picture

Status: Needs review » Needs work

Thanks for the patch!

+++ b/src/Form/CookiebotForm.php
@@ -108,6 +108,13 @@ class CookiebotForm extends ConfigFormBase {
+      '#description' => $this->t('Use Drupal language for the cookie popup. If not set Cookiebot will autodetect the language from the user\'s browser.'),

Afaik "\'" is not the right way for translated strings.
Use "double quotes" if some chars should be escaped. See \Drupal\Core\Cache\Context\UserRolesCacheContext::getLabel.

In addition let's call it "Use the current Drupal language ...". Unfortunately the Drupal language does not exist yet :)

a.milkovsky’s picture

Issue summary: View changes
arnested’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB

Afaik "\'" is not the right way for translated strings.

You are right. Its one of the things I actually know but always gets wrong anyway :)

In addition let's call it "Use the current Drupal language ...". Unfortunately the Drupal language does not exist yet :)

:)

Fixed.

New patch attached.

arnested’s picture

StatusFileSize
new5.87 KB

Actually, when introducing support for the data-culture attribute we should also use it on the cookie declaration block.

Updated patch attached.

bibliophileaxe’s picture

This still doesn't work if we language fallback module. If we are using 2 language, the langcode would be something like language1-language2, in this case, the culture attribute doesn't work. Added an alter hook to alter the langcode as needed.

nachosalvador’s picture

Status: Needs review » Reviewed & tested by the community

I applied patch #8 and works as expected.

tijsdeboeck’s picture

I've tested patch #8 as well, indeed works as expected!

bramdriesen’s picture

RTBC +1

  • BramDriesen committed f84b408 on 8.x-1.x authored by arnested
    Issue #3071334 by arnested, akanksha-hp, a.milkovsky, BramDriesen,...
bramdriesen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.