From 372f3b4aba1f8cd888d36d90aeae9b3ef618453c Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Mon, 11 Jun 2018 00:42:45 +0200 Subject: [PATCH] Make some menus translatable (#12885) * Make some menus translatable * Update changelog --- CHANGELOG.md | 4 ++++ core/Plugin/Menu.php | 2 +- lang/en.json | 1 + plugins/API/Menu.php | 2 +- plugins/CoreAdminHome/lang/en.json | 1 + plugins/CustomVariables/Menu.php | 2 +- plugins/ExamplePlugin/Menu.php | 8 ++++---- plugins/ExampleUI/Menu.php | 2 +- plugins/ExampleUI/lang/en.json | 3 ++- plugins/Morpheus/Menu.php | 2 +- plugins/PrivacyManager/Menu.php | 8 ++++---- plugins/PrivacyManager/lang/en.json | 6 +++++- 12 files changed, 26 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b62d301d00b..2df4ae011a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * Added new event `API.addGlossaryItems` which lets you add items to the glossary. +### Breaking Changes + +* Changed some menu items to use translation keys instead (see [PR #12885](https://github.com/matomo-org/matomo/pull/12885)). + ## Matomo 3.5.1 ### New APIs diff --git a/core/Plugin/Menu.php b/core/Plugin/Menu.php index 99275a5aeb0..f8efe6a936b 100644 --- a/core/Plugin/Menu.php +++ b/core/Plugin/Menu.php @@ -47,7 +47,7 @@ private function getModule() * * Example: * ``` - * $menu->addItem('UI Framework', '', $this->urlForDefaultAction(), $orderId = 30); + * $menu->addItem('MyPlugin_MyPlugin', '', $this->urlForDefaultAction(), $orderId = 30); * // will add a menu item that leads to the default action of the plugin controller when a user clicks on it. * // The default action is usually the `index` action - meaning the `index()` method the controller - * // but the default action can be customized within a controller diff --git a/lang/en.json b/lang/en.json index a52d7248735..72360ee5f8f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -510,6 +510,7 @@ "LoginCredentials": "Credentials", "LoginToPiwikToChangeSettings": "Login to your Matomo server to create and update websites, users or to change General Settings like \"Report to load by default\".", "LoginUseHttps": "Use https", + "MatomoMobile": "Matomo Mobile App", "MultiChartLabel": "Display sparklines", "NavigationBack": "Back", "NetworkError": "Network Error", diff --git a/plugins/API/Menu.php b/plugins/API/Menu.php index 6202af89f5a..0f0aa8fd181 100644 --- a/plugins/API/Menu.php +++ b/plugins/API/Menu.php @@ -59,7 +59,7 @@ private function addTopMenuMobileApp(MenuTop $menu) $url = $this->urlForModuleAction('Proxy', 'redirect', array('url' => 'https://matomo.org/mobile/')); if ($url) { - $menu->addItem('Piwik Mobile App', null, $url, 4); + $menu->addItem('Mobile_MatomoMobile', null, $url, 4); } } } diff --git a/plugins/CoreAdminHome/lang/en.json b/plugins/CoreAdminHome/lang/en.json index 0c8e4c8fd80..2f5a0f26b0e 100644 --- a/plugins/CoreAdminHome/lang/en.json +++ b/plugins/CoreAdminHome/lang/en.json @@ -91,6 +91,7 @@ "TrackingCodeIntro": "Matomo offers you various ways to embed the tracking code for your website, mobile app, and even for any device or application.", "TrustedHostConfirm": "Are you sure you want to change the trusted Matomo hostname?", "TrustedHostSettings": "Trusted Matomo Hostname", + "UiDemo": "UI Demo", "UpdateSettings": "Update settings", "UseCustomLogo": "Use a custom logo", "ValidPiwikHostname": "Valid Matomo Hostname", diff --git a/plugins/CustomVariables/Menu.php b/plugins/CustomVariables/Menu.php index 25b73712c5c..4158425088c 100644 --- a/plugins/CustomVariables/Menu.php +++ b/plugins/CustomVariables/Menu.php @@ -27,7 +27,7 @@ public function configureAdminMenu(MenuAdmin $menu) $idSite = Common::getRequestVar('idSite', $default, 'int'); if (Piwik::isUserHasAdminAccess($idSite)) { - $menu->addDiagnosticItem('Custom Variables', $this->urlForAction('manage'), $orderId = 20); + $menu->addDiagnosticItem('CustomVariables_CustomVariables', $this->urlForAction('manage'), $orderId = 20); } } } diff --git a/plugins/ExamplePlugin/Menu.php b/plugins/ExamplePlugin/Menu.php index 38ac0d4af8e..5f1bf12107e 100644 --- a/plugins/ExamplePlugin/Menu.php +++ b/plugins/ExamplePlugin/Menu.php @@ -21,16 +21,16 @@ class Menu extends \Piwik\Plugin\Menu public function configureTopMenu(MenuTop $menu) { - // $menu->addItem('My Top Item', null, $this->urlForDefaultAction(), $orderId = 30); + // $menu->addItem('ExamplePlugin_MyTopItem', null, $this->urlForDefaultAction(), $orderId = 30); } public function configureAdminMenu(MenuAdmin $menu) { // reuse an existing category. Execute the showList() method within the controller when menu item was clicked - // $menu->addManageItem('My User Item', $this->urlForAction('showList'), $orderId = 30); - // $menu->addPlatformItem('My User Item', $this->urlForDefaultAction(), $orderId = 30); + // $menu->addManageItem('ExamplePlugin_MyUserItem', $this->urlForAction('showList'), $orderId = 30); + // $menu->addPlatformItem('ExamplePlugin_MyUserItem', $this->urlForDefaultAction(), $orderId = 30); // or create a custom category - // $menu->addItem('CoreAdminHome_MenuManage', 'My User Item', $this->urlForDefaultAction(), $orderId = 30); + // $menu->addItem('CoreAdminHome_MenuManage', 'ExamplePlugin_MyUserItem', $this->urlForDefaultAction(), $orderId = 30); } } diff --git a/plugins/ExampleUI/Menu.php b/plugins/ExampleUI/Menu.php index a99cca552c9..64e6b04c680 100644 --- a/plugins/ExampleUI/Menu.php +++ b/plugins/ExampleUI/Menu.php @@ -14,6 +14,6 @@ class Menu extends \Piwik\Plugin\Menu { public function configureAdminMenu(MenuAdmin $menu) { - $menu->addPlatformItem('UI Notifications', $this->urlForAction('notifications'), $order = 10); + $menu->addPlatformItem('ExampleUI_UiNotifications', $this->urlForAction('notifications'), $order = 10); } } diff --git a/plugins/ExampleUI/lang/en.json b/plugins/ExampleUI/lang/en.json index e0c05c5411f..425570e7621 100644 --- a/plugins/ExampleUI/lang/en.json +++ b/plugins/ExampleUI/lang/en.json @@ -1,8 +1,9 @@ { "ExampleUI": { "UiFramework": "UI Framework", + "UiNotifications": "UI Notifications", "GetTemperaturesDataTable": "Data tables", "GetTemperaturesEvolution": "Temperatures evolution over time", "TemperaturesEvolution": "Evolution of server temperatures over the last few days" } -} \ No newline at end of file +} diff --git a/plugins/Morpheus/Menu.php b/plugins/Morpheus/Menu.php index 86fffd7539c..7d3729af46e 100644 --- a/plugins/Morpheus/Menu.php +++ b/plugins/Morpheus/Menu.php @@ -31,7 +31,7 @@ public function configureAdminMenu(MenuAdmin $menu) $menu->registerMenuIcon('MobileAppMeasurable_MobileApps', $manageMeasurablesIcon); if (Development::isEnabled() && Piwik::isUserHasSomeAdminAccess()) { - $menu->addDevelopmentItem('UI Demo', $this->urlForAction('demo')); + $menu->addDevelopmentItem('CoreAdminHome_UiDemo', $this->urlForAction('demo')); } } } diff --git a/plugins/PrivacyManager/Menu.php b/plugins/PrivacyManager/Menu.php index 949b733e6b6..adacf8c9cb5 100644 --- a/plugins/PrivacyManager/Menu.php +++ b/plugins/PrivacyManager/Menu.php @@ -24,10 +24,10 @@ public function configureAdminMenu(MenuAdmin $menu) $menu->addItem($category, 'PrivacyManager_AnonymizeData', $this->urlForAction('privacySettings'), 5); } - $menu->addItem($category, 'Users opt-out', $this->urlForAction('usersOptOut'), 10); - $menu->addItem($category, 'Asking for consent', $this->urlForAction('consent'), 15); - $menu->addItem($category, 'GDPR Overview', $this->urlForAction('gdprOverview'), 20); - $menu->addItem($category, 'GDPR Tools', $this->urlForAction('gdprTools'), 25); + $menu->addItem($category, 'PrivacyManager_UsersOptOut', $this->urlForAction('usersOptOut'), 10); + $menu->addItem($category, 'PrivacyManager_AskingForConsent', $this->urlForAction('consent'), 15); + $menu->addItem($category, 'PrivacyManager_GdprOverview', $this->urlForAction('gdprOverview'), 20); + $menu->addItem($category, 'PrivacyManager_GdprTools', $this->urlForAction('gdprTools'), 25); } } } diff --git a/plugins/PrivacyManager/lang/en.json b/plugins/PrivacyManager/lang/en.json index db35747315a..42e417fc7f8 100644 --- a/plugins/PrivacyManager/lang/en.json +++ b/plugins/PrivacyManager/lang/en.json @@ -6,6 +6,7 @@ "AnonymizeIpExtendedHelp": "When users visit your website, Matomo will not use the full IP address (such as %1$s) but instead Matomo will anonymise it first (to %2$s). IP address anonymisation is one of the requirements set by the privacy laws in some countries such as Germany.", "AnonymizeIpMaskLengtDescription": "Select how many bytes of the visitors' IPs should be masked.", "AnonymizeIpMaskLength": "%1$s byte(s) - e.g. %2$s", + "AskingForConsent": "Asking for consent", "CannotLockSoDeleteLogActions": "The log_action table will not be purged: please grant the LOCK TABLES privilege to the '%s' MySQL user.", "ClickHereSettings": "Click here to access the %s settings.", "CurrentDBSize": "Current database size", @@ -43,6 +44,8 @@ "GeolocationAnonymizeIpNote": "Note: Geolocation will have approximately the same results with 1 byte anonymized. With 2 bytes or more, Geolocation will be inaccurate.", "GDPR": "GDPR", "GdprManager": "GDPR Manager", + "GdprOverview": "GDPR Overview", + "GdprTools": "GDPR Tools", "GetPurgeEstimate": "Get purge estimate", "KeepBasicMetrics": "Keep basic metrics (visits, page views, bounce rate, goal conversions, ecommerce conversions, etc.)", "KeepDataFor": "Keep all data for", @@ -73,6 +76,7 @@ "PseudonymizeUserId": "Replace User ID with a pseudonym", "UseAnonymizeOrderId": "Anonymize Order ID", "UseDeleteLog": "Regularly delete old visitor logs from the database", - "UseDeleteReports": "Regularly delete old reports from the database" + "UseDeleteReports": "Regularly delete old reports from the database", + "UsersOptOut": "Users opt-out" } }