From c5e238f1d542c793aa7ca5c23b463339f31896bd Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Mon, 23 Nov 2026 17:02:09 -0800 Subject: [PATCH 1/4] fix(i18n): use monitor text domain for monitor_list setting and refresh cacti.pot Pass the 'monitor' gettext domain instead of 'thold' for the monitor_list setting label and description in setup.php so translations resolve against monitor's catalog at runtime. Refresh locales/po/cacti.pot to include the two current monitor_enable and monitor_disable confirmation strings and drop the removed placeholder variant. Leave per-language .po and .mo catalogs untouched. Fixes #292. Related: Cacti/cacti#8907, Cacti/cacti#8924 Signed-off-by: Thomas Vincent --- CHANGELOG.md | 1 + locales/po/cacti.pot | 9 +++-- setup.php | 4 +- tests/Unit/MonitorConfigSettingsTest.php | 48 ++++++++++++++++++++++++ tests/bootstrap-unit.php | 6 +++ 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 tests/Unit/MonitorConfigSettingsTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d4909a7..1fd81ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ installation guidance and source-checked behavior. --- 3.0 --- +* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, and refresh `locales/po/cacti.pot` to match current PHP source strings * security: Require POST for the save, remove, mute and card-order actions so csrf-magic covers them, and only let a dashboard's owner save over it * security: Bind the plugin version lookup and the device_remove cleanup deletes as prepared statements instead of building them from the device list * bug: Escape the device description, location, site name and Monitor Text in the List view diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index a5a0285..5a26765 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Cacti \n" "Report-Msgid-Bugs-To: developers@cacti.net\n" -"POT-Creation-Date: 2026-10-11 17:03-0400\n" +"POT-Creation-Date: 2026-11-23 16:54-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Cacti Developers \n" "Language-Team: Cacti Developers \n" @@ -850,8 +850,11 @@ msgid "Any" msgstr "" #: setup.php -#, php-format -msgid "Click 'Continue' to %s monitoring on these Device(s)" +msgid "Click 'Continue' to enable monitoring on these Device(s)" +msgstr "" + +#: setup.php +msgid "Click 'Continue' to disable monitoring on these Device(s)" msgstr "" #: setup.php diff --git a/setup.php b/setup.php index 5b42b3c..b01c5f9 100644 --- a/setup.php +++ b/setup.php @@ -939,8 +939,8 @@ function monitor_config_settings() { 'max_length' => '255' ], 'monitor_list' => [ - 'friendly_name' => __('Notification List', 'thold'), - 'description' => __('Select a Notification List below. All Emails subscribed to the notification list will be notified.', 'thold'), + 'friendly_name' => __('Notification List', 'monitor'), + 'description' => __('Select a Notification List below. All Emails subscribed to the notification list will be notified.', 'monitor'), 'method' => 'drop_sql', 'sql' => 'SELECT id, name FROM plugin_notification_lists ORDER BY name', 'default' => '', diff --git a/tests/Unit/MonitorConfigSettingsTest.php b/tests/Unit/MonitorConfigSettingsTest.php new file mode 100644 index 0000000..bdcd0cf --- /dev/null +++ b/tests/Unit/MonitorConfigSettingsTest.php @@ -0,0 +1,48 @@ + '1 Minute'); + $settings_user = array(); + $tabs_graphs = array(); + + monitor_config_settings(); + + expect($tabs)->toHaveKey('monitor'); + expect($settings['monitor'])->toHaveKey('monitor_list'); + expect($settings['monitor']['monitor_list']['friendly_name'])->toBe('Notification List'); + expect($settings['monitor']['monitor_list']['description'])->toContain('Notification List'); +}); + +it('uses the monitor text domain for monitor_list labels in setup.php', function () { + $source = plugin_test_read_source('setup.php'); + + expect($source)->toContain("__('Notification List', 'monitor')"); + expect($source)->not->toContain("__('Notification List', 'thold')"); + expect($source)->not->toContain("'thold'"); +}); diff --git a/tests/bootstrap-unit.php b/tests/bootstrap-unit.php index 8e343fb..d3aceae 100644 --- a/tests/bootstrap-unit.php +++ b/tests/bootstrap-unit.php @@ -101,6 +101,12 @@ function get_selected_theme() { } } +if (!function_exists('get_current_page')) { + function get_current_page() { + return $GLOBALS['__test_current_page'] ?? ''; + } +} + if (!function_exists('monitor_test_mock_db')) { function monitor_test_mock_db($fn, $match, $result) { $GLOBALS['__test_db_fixtures'][] = array('fn' => $fn, 'match' => $match, 'result' => $result); From 1db7ec1e4dd0fc3cf4280f33e3017f39fcd5edb7 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Mon, 23 Nov 2026 18:44:56 -0800 Subject: [PATCH 2/4] fix(i18n): check the text domain of every translation call and fix two misses Signed-off-by: Thomas Vincent --- CHANGELOG.md | 2 +- locales/po/cacti.pot | 2 +- setup.php | 4 +- tests/Unit/I18nTextDomainTest.php | 62 +++++++ tests/Unit/MonitorConfigSettingsTest.php | 12 +- tests/bin/check-i18n-domain.php | 223 +++++++++++++++++++++++ 6 files changed, 291 insertions(+), 14 deletions(-) create mode 100644 tests/Unit/I18nTextDomainTest.php create mode 100644 tests/bin/check-i18n-domain.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd81ee..8235db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ installation guidance and source-checked behavior. --- 3.0 --- -* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, and refresh `locales/po/cacti.pot` to match current PHP source strings +* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, pass it to the Criticality and Normal User labels in `setup.php` that had no domain, add a test that every translation helper call passes the plugin text domain, and refresh `locales/po/cacti.pot` to match current PHP source strings * security: Require POST for the save, remove, mute and card-order actions so csrf-magic covers them, and only let a dashboard's owner save over it * security: Bind the plugin version lookup and the device_remove cleanup deletes as prepared statements instead of building them from the device list * bug: Escape the device description, location, site name and Monitor Text in the List view diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index 5a26765..8d419ff 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Cacti \n" "Report-Msgid-Bugs-To: developers@cacti.net\n" -"POT-Creation-Date: 2026-11-23 16:54-0800\n" +"POT-Creation-Date: 2026-10-11 17:03-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Cacti Developers \n" "Language-Team: Cacti Developers \n" diff --git a/setup.php b/setup.php index b01c5f9..bc1ba9d 100644 --- a/setup.php +++ b/setup.php @@ -162,7 +162,7 @@ function monitor_device_table_bottom() { ]; if (version_compare(CACTI_VERSION, '1.3.0', '<')) { - $select = '' . __('Criticality') . ''; foreach ($criticalities as $index => $crit) { if ($index == get_request_var('criticality')) { @@ -713,7 +713,7 @@ function monitor_config_settings() { ]; if (function_exists('auth_augment_roles')) { - auth_augment_roles(__('Normal User'), ['monitor.php']); + auth_augment_roles(__('Normal User', 'monitor'), ['monitor.php']); } $tabs_graphs += ['monitor' => __('Monitor Settings', 'monitor')]; diff --git a/tests/Unit/I18nTextDomainTest.php b/tests/Unit/I18nTextDomainTest.php new file mode 100644 index 0000000..92fd99e --- /dev/null +++ b/tests/Unit/I18nTextDomainTest.php @@ -0,0 +1,62 @@ + number of calls. They are listed so the check passes without + * widening the change that introduced it. The count must match exactly: + * fixing a call without lowering its count here fails the test, so the + * list can only shrink. Do not add entries for new code. + */ + $known = [ + // nav bar and list labels with no domain (one is the core 'Devices' label) + 'includes/render.php' => 2, + // report e-mail paragraph + 'poller_functions.php' => 1, + ]; + + $found = []; + + foreach (i18n_domain_offenders(dirname(__DIR__, 2), 'monitor') as $offender) { + $found[$offender['file']][] = $offender['file'] . ':' . $offender['line'] . ' ' . $offender['call'] . ': ' . $offender['reason']; + } + + $unexpected = []; + + foreach ($found as $file => $lines) { + if (count($lines) !== ($known[$file] ?? 0)) { + $unexpected = array_merge($unexpected, $lines); + } + } + + foreach ($known as $file => $count) { + if (!isset($found[$file])) { + $unexpected[] = $file . ': expected ' . $count . ' known calls without the text domain, found none; remove it from the list'; + } + } + + expect($unexpected)->toBe([]); +}); diff --git a/tests/Unit/MonitorConfigSettingsTest.php b/tests/Unit/MonitorConfigSettingsTest.php index bdcd0cf..ebf4f38 100644 --- a/tests/Unit/MonitorConfigSettingsTest.php +++ b/tests/Unit/MonitorConfigSettingsTest.php @@ -6,8 +6,8 @@ */ /* - * Unit coverage for monitor_config_settings() in setup.php, including - * verification that monitor_list labels register under the monitor domain. + * Unit coverage for monitor_config_settings() in setup.php. Text domain usage + * is covered for the whole plugin by I18nTextDomainTest.php. */ beforeAll(function () { @@ -38,11 +38,3 @@ expect($settings['monitor']['monitor_list']['friendly_name'])->toBe('Notification List'); expect($settings['monitor']['monitor_list']['description'])->toContain('Notification List'); }); - -it('uses the monitor text domain for monitor_list labels in setup.php', function () { - $source = plugin_test_read_source('setup.php'); - - expect($source)->toContain("__('Notification List', 'monitor')"); - expect($source)->not->toContain("__('Notification List', 'thold')"); - expect($source)->not->toContain("'thold'"); -}); diff --git a/tests/bin/check-i18n-domain.php b/tests/bin/check-i18n-domain.php new file mode 100644 index 0000000..42dfbac --- /dev/null +++ b/tests/bin/check-i18n-domain.php @@ -0,0 +1,223 @@ + + * + * Exits 1 and prints file:line for each offender, 0 when there are none. + */ + +if (!function_exists('i18n_domain_offenders')) { + /** + * @param string $root Plugin root directory. + * @param string $domain Text domain every helper call must pass. + * + * @return array + */ + function i18n_domain_offenders($root, $domain) { + $root = rtrim(realpath($root), '/'); + $offenders = []; + + foreach (i18n_domain_files($root) as $file) { + $relative = substr($file, strlen($root) + 1); + + foreach (i18n_domain_check_source(file_get_contents($file), $domain) as $offender) { + $offender['file'] = $relative; + $offenders[] = $offender; + } + } + + return $offenders; + } + + /** + * @param string $root Plugin root directory. + * + * @return array Absolute paths, sorted. + */ + function i18n_domain_files($root) { + $skip = ['vendor', 'tests', 'locales']; + $files = []; + + $iterator = new RecursiveIteratorIterator( + new RecursiveCallbackFilterIterator( + new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS), + function ($current) use ($root, $skip) { + $relative = substr($current->getPathname(), strlen($root) + 1); + + if ($current->getFilename()[0] === '.') { + return false; + } + + if ($current->isDir()) { + return !in_array($relative, $skip, true); + } + + return $current->getExtension() === 'php'; + } + ) + ); + + foreach ($iterator as $file) { + $files[] = $file->getPathname(); + } + + sort($files); + + return $files; + } + + /** + * @param string $source PHP source code. + * @param string $domain Expected text domain. + * + * @return array + */ + function i18n_domain_check_source($source, $domain) { + // Position of the domain argument: an index from the start, or -1 for the last argument. + $positions = [ + '__' => -1, '__esc' => -1, '__x' => -1, '__esc_x' => -1, + '__n' => 3, '__esc_n' => 3, '__xn' => 4, '__esc_xn' => 4, + '__gettext' => 1, + ]; + + $tokens = array_values(array_filter( + token_get_all($source), + function ($token) { + return !is_array($token) || !in_array($token[0], [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT], true); + } + )); + $offenders = []; + $count = count($tokens); + + for ($i = 0; $i < $count; $i++) { + if (!is_array($tokens[$i]) || !in_array($tokens[$i][0], [T_STRING, T_NAME_FULLY_QUALIFIED], true)) { + continue; + } + + $name = ltrim($tokens[$i][1], '\\'); + + if (!isset($positions[$name]) || ($tokens[$i + 1] ?? null) !== '(') { + continue; + } + + // Skip method calls, static calls, declarations and instantiations. + $previous = $tokens[$i - 1] ?? null; + + if (is_array($previous) && in_array($previous[0], [T_OBJECT_OPERATOR, T_NULLSAFE_OBJECT_OPERATOR, T_DOUBLE_COLON, T_FUNCTION, T_NEW], true)) { + continue; + } + + $arguments = i18n_domain_arguments($tokens, $i + 1); + $wanted = $positions[$name] === -1 ? count($arguments) - 1 : $positions[$name]; + $reason = null; + + if (!isset($arguments[$wanted]) || ($positions[$name] === -1 && count($arguments) < 2)) { + $reason = 'no text domain argument'; + } elseif (count($arguments[$wanted]) !== 1 || !is_array($arguments[$wanted][0]) || $arguments[$wanted][0][0] !== T_CONSTANT_ENCAPSED_STRING) { + $reason = 'text domain is not a string literal'; + } elseif (substr($arguments[$wanted][0][1], 1, -1) !== $domain) { + $reason = "text domain is " . $arguments[$wanted][0][1] . ", expected '" . $domain . "'"; + } + + if ($reason !== null) { + $offenders[] = ['line' => $tokens[$i][2], 'call' => $name . '()', 'reason' => $reason]; + } + } + + return $offenders; + } + + /** + * Split the arguments of the call whose opening parenthesis is at $open. + * + * @param array $tokens Significant tokens. + * @param int $open Index of the '(' token. + * + * @return array> Tokens of each top-level argument. + */ + function i18n_domain_arguments($tokens, $open) { + $arguments = [[]]; + $depth = 0; + $count = count($tokens); + + for ($i = $open; $i < $count; $i++) { + $token = $tokens[$i]; + $text = is_array($token) ? $token[1] : $token; + + if ($text === '(' || $text === '[' || $text === '{' || (is_array($token) && in_array($token[0], [T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES], true))) { + $depth++; + + if ($depth === 1) { + continue; + } + } elseif ($text === ')' || $text === ']' || $text === '}') { + $depth--; + + if ($depth === 0) { + break; + } + } elseif ($text === ',' && $depth === 1) { + $arguments[] = []; + + continue; + } + + $arguments[count($arguments) - 1][] = $token; + } + + // A trailing comma leaves an empty last argument. + if (end($arguments) === []) { + array_pop($arguments); + } + + return $arguments; + } +} + +if (PHP_SAPI === 'cli' && isset($argv[0]) && realpath($argv[0]) === __FILE__) { + $domain = $argv[1] ?? ''; + + if ($domain === '') { + fwrite(STDERR, "Usage: php tests/bin/check-i18n-domain.php \n"); + + exit(2); + } + + $offenders = i18n_domain_offenders(dirname(__DIR__, 2), $domain); + + foreach ($offenders as $offender) { + print $offender['file'] . ':' . $offender['line'] . ' ' . $offender['call'] . ': ' . $offender['reason'] . "\n"; + } + + exit($offenders === [] ? 0 : 1); +} From f4d9531fb18d861e548595424ef7c71d99e2fc4a Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Mon, 23 Nov 2026 19:00:18 -0800 Subject: [PATCH 3/4] chore(i18n): remove orphan ka.mo binary Remove locales/LC_MESSAGES/ka.mo left behind after the locale rename to ka-GE (no matching ka.po exists; ka-GE.mo is already present). Refs #292, Cacti/cacti#8925. Signed-off-by: Thomas Vincent --- CHANGELOG.md | 2 +- locales/LC_MESSAGES/ka.mo | Bin 3345 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 locales/LC_MESSAGES/ka.mo diff --git a/CHANGELOG.md b/CHANGELOG.md index 8235db1..b61f0f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ installation guidance and source-checked behavior. --- 3.0 --- -* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, pass it to the Criticality and Normal User labels in `setup.php` that had no domain, add a test that every translation helper call passes the plugin text domain, and refresh `locales/po/cacti.pot` to match current PHP source strings +* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, pass it to the Criticality and Normal User labels in `setup.php` that had no domain, add a test that every translation helper call passes the plugin text domain, refresh `locales/po/cacti.pot` to match current PHP source strings, and remove orphan `locales/LC_MESSAGES/ka.mo` * security: Require POST for the save, remove, mute and card-order actions so csrf-magic covers them, and only let a dashboard's owner save over it * security: Bind the plugin version lookup and the device_remove cleanup deletes as prepared statements instead of building them from the device list * bug: Escape the device description, location, site name and Monitor Text in the List view diff --git a/locales/LC_MESSAGES/ka.mo b/locales/LC_MESSAGES/ka.mo deleted file mode 100644 index 9c3640a51911b17c1f3a0bd1432f82e7d86b8201..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3345 zcma)+TZ|J`7=Vw0C`D001g{Jz$i;41goG3@7IuL(+uhAxK#32|wr9Juv@^}jlofn2 zsflPzya0kCaS>6`_41%^_+SEwi7~`PW8wp*#wQYA@Ij)9@%!hTwn$>aq-VZ!{{KJ! z?VRa_c{2|yp7o4-8E3CkYC9~?;Kg%brc!g@i|__`7>eo`ycxa&Z-Ucs7W~q#&%oKN z&%qnvd8_{kioXk1ei6$4OOT)X+pZ;;tY<^f&xI+t5K7#omKi8^o1o;CgOW!#6#HJQ z-(~erL4N9KyB>qGf5OTGDEn$q@_r7AzXMS0Ua{*#c74op%F0hc**9(Z1(f{HKz`~R zFX_v-Q2hM}#r|i@U*YwvFIxTYQ2KSr>i@CwStKQWm;+zt%of3WSf9e#Joq)dAO2wZ zhvhtyS%kb3-UT0rOJNZ{2w#A=!f7ae&cKJ@c_{w>wDS2BA?xK(?6$yVa0H6|vv4Im z30J}IAU}1Pm)KuVlNZ1Ra0y%uC9gb`a~!kl2`Ks0q1YdUQrBsih2KEQV+KuH2Ny%J z8-}uP!g4>9e!XP%N8p{TKe6(&Q1bfT>VJc)SpQ|$%h)XXjZotCLGd?XISDtgejZ9a zUqPwo7t70#V`@DQv}WdhG?#ZUaTwAodD0B&=Uj%IS0_Ur>4DsnM;H=Mo(_hbC09f( zW?cE)!a~kRzHzzF@=#jRBU+f;K~hZq2c$2}M|vv#T*(XGSFCux%K7_LZm;W=-BGXX z#j?<$Thfu*>iPv;R$BuAYH?Bn%Sv6D}ozR6?4eLs^>|!+RmGL?pdZm&Msf<}gjrh_~A4WJW zs*$SN>5<1SH}o^PvJPpS%q5H6K~PZ@uUz&bQuB+E8VCc4k?tv`cj_>rfmvs}4#JY> z`p$~2wB1{o8r0PwjMMq33n~>E9dO! z&*pnp@9yvGPW8G`oE{EcKcb2t%sSgfdV8I|T)x}c)Sb`u^gfpB>Kg1G8hR8{zf|Mw z)5F@WT#?D9@i?wV*-R$3ZgfXMa_jJQoT-``qD&&nRLt>Y_PCk0!>qH%P33#?-R&|v zJJzJ+YH6SB_Ekwg*3aOr?0Wu2r!ek@k&ZWy3~x(sXxmBnF&(D6{X$TrrCDdgs28UO z%C*ofr?&-RCCWN}HCaZR*KTyobhGa)+3a*~Og)j_u6?d|(uZAoRL<2|-_hCGu`Z<= z^@EN2tBv}xM*VoBKAlVsHR`V+M27-3x}%Ny+q@A0qepb2sY5bl)Oa|YY{DD+j05J@ zAv+L#*r=aOCT}HCtv{TS`ax}{p*1U}3Jd z90DTF2@CQy&f4dVH`FA;=@_@7Go5H38xs7OKI6y4XnhGJC7W8Q8i!W;anr9vYPmMO zlnOX1GNl5mG@lV~bC_a6HdjmK*y#`%+nuIEEZ9aOwl{djKlu=k4^={#^zk>9NKH$a zo8sBs{vynW$399yO+0ac35P^H(_o2YDo4@kCL!4*y3}qtIx1(y!nBi*N|cF? pEZfJBXR*=M#wY*) From e4c3830ba965826be6f7ff04bdc281ef477fdd14 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Mon, 23 Nov 2026 19:05:09 -0800 Subject: [PATCH 4/4] fix(i18n): leave the core role name alone and follow the code style Signed-off-by: Thomas Vincent --- CHANGELOG.md | 2 +- setup.php | 2 +- tests/Unit/I18nTextDomainTest.php | 2 ++ tests/bin/check-i18n-domain.php | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b61f0f5..b46b191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ installation guidance and source-checked behavior. --- 3.0 --- -* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, pass it to the Criticality and Normal User labels in `setup.php` that had no domain, add a test that every translation helper call passes the plugin text domain, refresh `locales/po/cacti.pot` to match current PHP source strings, and remove orphan `locales/LC_MESSAGES/ka.mo` +* issue#292: Use the `'monitor'` gettext text domain for the `monitor_list` setting labels in `setup.php` instead of `'thold'`, pass it to the Criticality label in `setup.php` that had no domain, add a test that every translation helper call passes the plugin text domain, refresh `locales/po/cacti.pot` to match current PHP source strings, and remove orphan `locales/LC_MESSAGES/ka.mo` * security: Require POST for the save, remove, mute and card-order actions so csrf-magic covers them, and only let a dashboard's owner save over it * security: Bind the plugin version lookup and the device_remove cleanup deletes as prepared statements instead of building them from the device list * bug: Escape the device description, location, site name and Monitor Text in the List view diff --git a/setup.php b/setup.php index bc1ba9d..9a90123 100644 --- a/setup.php +++ b/setup.php @@ -713,7 +713,7 @@ function monitor_config_settings() { ]; if (function_exists('auth_augment_roles')) { - auth_augment_roles(__('Normal User', 'monitor'), ['monitor.php']); + auth_augment_roles(__('Normal User'), ['monitor.php']); } $tabs_graphs += ['monitor' => __('Monitor Settings', 'monitor')]; diff --git a/tests/Unit/I18nTextDomainTest.php b/tests/Unit/I18nTextDomainTest.php index 92fd99e..f0d61ee 100644 --- a/tests/Unit/I18nTextDomainTest.php +++ b/tests/Unit/I18nTextDomainTest.php @@ -36,6 +36,8 @@ 'includes/render.php' => 2, // report e-mail paragraph 'poller_functions.php' => 1, + // core role name passed to auth_augment_roles() + 'setup.php' => 1, ]; $found = []; diff --git a/tests/bin/check-i18n-domain.php b/tests/bin/check-i18n-domain.php index 42dfbac..be3c710 100644 --- a/tests/bin/check-i18n-domain.php +++ b/tests/bin/check-i18n-domain.php @@ -146,7 +146,7 @@ function ($token) { } elseif (count($arguments[$wanted]) !== 1 || !is_array($arguments[$wanted][0]) || $arguments[$wanted][0][0] !== T_CONSTANT_ENCAPSED_STRING) { $reason = 'text domain is not a string literal'; } elseif (substr($arguments[$wanted][0][1], 1, -1) !== $domain) { - $reason = "text domain is " . $arguments[$wanted][0][1] . ", expected '" . $domain . "'"; + $reason = 'text domain is ' . $arguments[$wanted][0][1] . ", expected '" . $domain . "'"; } if ($reason !== null) {