Skip to content

TMS-1209: Rework window.s translations inline script#550

Merged
eebbi merged 4 commits intomasterfrom
TMS-1209
Oct 22, 2025
Merged

TMS-1209: Rework window.s translations inline script#550
eebbi merged 4 commits intomasterfrom
TMS-1209

Conversation

@eebbi
Copy link
Contributor

@eebbi eebbi commented Oct 17, 2025

Projekti: Tampereen kaupunki, konsernihallinto / Tietohallintoyksikkö: Tampere multisite support
Tiketin kuvaus: TMS-1209 Vapriikki: valikko ei avaudu ja etusivulla Näyttely eivät näy oikein
Task: https://hiondigital.atlassian.net/browse/TMS-1209

Description

Rework translation localization inline script and ignore it from cookiebot.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@eebbi eebbi requested a review from Copilot October 17, 2025 11:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reworks the translation localization inline script implementation to fix an issue where the menu wouldn't open and homepage exhibitions weren't displaying correctly in the Vapriikki site. The main change moves translation data from wp_localize_script to a custom inline script with cookiebot-ignore attributes.

  • Replaced wp_localize_script with a custom footer method that adds data-cookieconsent="ignore" attribute
  • Added consistent namespace prefixing with backslashes throughout the file
  • Moved localization script generation to the footer to avoid conflicts

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/Assets.php Reworked translation localization implementation and added namespace prefixing
CHANGELOG.MD Added entry for the TMS-1209 fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@eebbi eebbi requested a review from a team October 21, 2025 19:04
@HPiirainen HPiirainen self-assigned this Oct 22, 2025
lib/Assets.php Outdated
*/
public static function add_localizations_to_footer() {
$script_strings = ( new \Strings() )->s();
$script = 'var s = ' . json_encode( $script_strings ) . ';';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= merkki linjaan

@eebbi eebbi merged commit 34655da into master Oct 22, 2025
2 of 4 checks passed
@eebbi eebbi deleted the TMS-1209 branch October 22, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants