Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log a proper warning when an unexected translation key is added to client side translations #22855

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Dec 13, 2024

Description:

In case a translation key is added to the client side translations that does not contain a _ a warning is currently triggered:

WARNING CoreHome[2024-12-13 12:02:09 UTC] [12316] /var/www/html/core/Translation/Translator.php(202): Warning - Undefined array key 1 - Matomo 5.2.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) #0/core/Translation/Translator.php(202),#1/core/AssetManager.php(147),#2/core/Twig.php(231),#3/tmp/templates_c/9b/9bcdbc324b7372161ba12b6ad9eb6285.php(43),#4/vendor/twig/twig/src/Template.php(360),#5/tmp/templates_c/b3/b35accd563c963c7f8a6fbee91f567bb.php(137),#6/vendor/twig/twig/src/Template.php(430),#7/vendor/twig/twig/src/Template.php(492),#8/tmp/templates_c/f9/f91be83f44d125f542a7d6c7c5b11fc0.php(68),#9/vendor/twig/twig/src/Template.php(430)

That does not really help a plugin developer to see where the problem is. This PR will discard such unexpected translations key and trigger a helpful warning instead.

refs #22853

Review

@sgiehl sgiehl added Needs Review PRs that need a code review Easier debugging For issues that make troubleshooting issues for developers easier. labels Dec 13, 2024
@sgiehl sgiehl added this to the 5.3.0 milestone Dec 13, 2024
@sgiehl sgiehl requested a review from a team December 13, 2024 14:40
@sgiehl sgiehl merged commit 3e24186 into 5.x-dev Dec 16, 2024
24 of 26 checks passed
@sgiehl sgiehl deleted the dev-18786 branch December 16, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easier debugging For issues that make troubleshooting issues for developers easier. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants