XSL translations being cached/rendered in the wrong language after sitemap rebuild.
Ensure translations are rendered based on the current request's language context.

Comments

mariatosheva created an issue. See original summary.

mariatosheva’s picture

StatusFileSize
new5.27 KB

Added LanguageManagerInterface dependency injection.
All $this->t() calls now explicitly pass the current language via ['langcode' => $langcode].
Added proper HTTP cache headers (Vary: Accept-Language, Cache-Control: no-cache, must-revalidate) to prevent incorrect caching.

mariatosheva’s picture

mariatosheva’s picture

StatusFileSize
new6.46 KB

Translations use explicit ['langcode' => $langcode] option to ensure correct language in XmlSitemapController.php.
The XSL URL is generated with the correct language prefix based on the sitemap context in XmlSitemapWriter.php.
Each sitemap XML file will have an XSL reference with the correct language prefix (e.g., /en/sitemap.xsl, /fr/sitemap.xsl).

poker10’s picture

Version: 8.x-1.5 » 8.x-1.x-dev
Status: Active » Needs work

Thanks for reporting this.

It would be great if you can create a MR instead of patches. That is a preffered way of contributing these days and we can also run pipelines on the MR. See: https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...

Does this also affect 2.x branch? If so, we should create MR for 2.x branch first (and then can probably backport the fix to 8.x-1.x, if needed).