- Issue created by @andre.bonon
- 🇧🇷Brazil andre.bonon
I noticed that this is already fixed by https://www.drupal.org/project/simplenews/issues/3317849 🐛 Multilingual tokens are not translated Needs work , but has not been merged yet.
The simplenews_generate_url() function currently builds unsubscribe links using the langcode option in the $options array passed to Url::fromRoute():
$url_arguments = ['absolute' => TRUE, 'langcode' => $subscriber->getLangcode()];
...
return Url::fromRoute("simplenews.subscriptions_$action", $route_parameters, $url_arguments)->toString();
The langcode key is not supported for generating translated URLs using Url::fromRoute(). The correct and recommended way is to use the language key and pass an instance of \Drupal\Core\Language\LanguageInterface.
Because of this, the unsubscribe link may not include the expected language prefix (e.g., /fr), and subscribers receive links in the default site language instead of their preferred language.
Use the right language key.
Active
4.1
Code
I noticed that this is already fixed by https://www.drupal.org/project/simplenews/issues/3317849 🐛 Multilingual tokens are not translated Needs work , but has not been merged yet.