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

Ensure only translation keys are added to client side translations for menu entries #22866

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Dec 16, 2024

Description:

Matomo provides the possibility for plugins to create the own menu entries. An example code would be

<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Plugins\PluginName;

use Piwik\Menu\MenuAdmin;
use Piwik\Piwik;

class Menu extends \Piwik\Plugin\Menu
{

    public function configureAdminMenu(MenuAdmin $menu)
    {
        if (Piwik::hasUserSuperUserAccess()) {
            $menu->addItem('Menu name', "Do some magic", $this->urlForAction('performAction'));
        }
    }
}

The menu entries can be provided as translation keys of strings. Currently Matomo has a problem when strings are provided for the top level, as it always tries to add them to the client side translations. There it fails to translate them.

fixes #22853

Review

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Dec 16, 2024
@sgiehl sgiehl added this to the 5.3.0 milestone Dec 16, 2024
@sgiehl sgiehl requested a review from a team December 16, 2024 10:02
@mneudert mneudert merged commit 30db94c into 5.x-dev Dec 16, 2024
26 checks passed
@mneudert mneudert deleted the dev-18786_2 branch December 16, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Translator.php(202): Warning - Undefined array key 1
2 participants