- Issue created by @kevinvb
- 🇧🇪Belgium kevinvb
Created a MR with the changes to have multilingual support for the usercentrics script.
- 🇩🇪Germany jan kellermann
Thank you very much for this issue and the MR.
The parameter
data-tcf-enabled
should not be hard-coded, there is a setting fot this paramater and will be added optionally in line 106ff.In most cases the consent dialog should be in browser's language, so this should be implemented as an adjustable option.
- 🇧🇪Belgium kevinvb
Indeed, I completely missed that tcf_enabled flag.
I know browser language is often used as the language of the cookie banner but this is often seen as a bug for clients as they want to have the banner follow the language of the site. So maybe a settings like a toggle to enable the interface language as the language of the consent dialog?
Normally Drupal has 'languages:language_interface' as a default cache context, not having that cache context in a multilingual setup will break like any usage of t(). So I'm not really sure if we need to add this too.
- Issue was unassigned.
- Status changed to Needs review
about 1 month ago 9:11pm 24 April 2025 - 🇩🇪Germany jan kellermann
I have now made the necessary adjustments.
Please review.
- 🇧🇪Belgium kevinvb
Just a thought.
getCurrentLanguage() from the LanguageManager service uses interface language as default but this would result in a bad result when:- The site is multilingual
- The interface language is fixed to eg English
- The content language follows the url and is French
In this case this part will always result 'English' while it should be French if the content language is French
elseif ($language == 'current') { $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); }
So I guess we better use LanguageInterface::TYPE_CONTENT no?