Skip to content

fix(i18n): pass the intropage text domain on 51 display strings - #374

Open
somethingwithproof wants to merge 1 commit into
Cacti:developfrom
somethingwithproof:fix/i18n-domain
Open

fix(i18n): pass the intropage text domain on 51 display strings#374
somethingwithproof wants to merge 1 commit into
Cacti:developfrom
somethingwithproof:fix/i18n-domain

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

locales/po ships translations for these strings in every supported language, and none of them ever displayed.

Cacti resolves __('text') against the core catalog and __('text', 'intropage') against the plugin's own. 921 call sites in this plugin already pass the domain. 51 did not, so those strings fell through to the core catalog, missed, and rendered in English regardless of the user's locale.

The German catalog is the clearest proof. locales/po/de-DE.po carries:

msgid "Select prepared panels from the \"Panels menu\". ..."
msgstr "Wählen Sie vorbereitete Paneele aus dem \"Menü Paneele\" aus. ..."

while display.php asked for it without the domain, so a German user saw the English line.

Affected: display.php, include/functions.php, panellib/analyze.php, panellib/busiest.php, panellib/graphs.php, panellib/misc.php, panellib/system.php.

The auth_augment_roles() role names deliberately keep the core domain. Core builds $user_auth_roles with __('Normal User') and __('System Administration') in the core catalog (include/global_arrays.php:1266), and auth_augment_roles() indexes that array by the exact string. Passing the plugin domain there would produce a different string on any translated install, key a role that does not exist, and silently fail to attach intropage.php and intropage_admin.php to the real roles. I made that mistake in the first draft of this branch; there is now a comment at the call site so it does not get "fixed" again.

Verification:

before   921 calls with the domain, 54 single-arg without, 0 multi-arg without
after    921 with the domain, 4 core-domain role lookups, 0 unintended
role calls  unchanged, and commented
php -l   clean across all 28 runtime files

No behavior change for an English install.

Without the domain Cacti looks the string up in the core catalog, so these
fell back to English even though locales/po carries translations for them in
every shipped language; the auth_augment_roles() role names stay core-domain
because core keys $user_auth_roles by exactly that string.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 03:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes i18n lookups in the Intropage plugin by ensuring user-facing strings are translated against the plugin’s gettext catalog (text domain intropage) instead of unintentionally falling back to Cacti core’s catalog.

Changes:

  • Add the intropage text domain to previously single-argument __() calls so existing plugin translations are actually used.
  • Preserve core-domain role-name lookups in auth_augment_roles() and document why they must remain core-domain to avoid realm assignment failures on translated installs.
  • Apply the domain fix across display/help UI and multiple panel libraries (system, misc checks, busiest, analyze, graphs).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
setup.php Documents why role-name lookups must stay in the core domain for correct realm augmentation.
display.php Ensures help/onboarding strings resolve in the plugin catalog by passing the intropage domain.
include/functions.php Fixes “panel not found” and related UI messages to use the intropage domain.
panellib/system.php Fixes remaining Boost panel strings (e.g., “Other”, “N/A”) to use the plugin domain.
panellib/misc.php Fixes Webseer/Servcheck status strings (“OK”/“Failed”) to use the plugin domain.
panellib/graphs.php Fixes graph detail strings (“Data Sources”, “No untemplated datasources found”) to use the plugin domain.
panellib/busiest.php Fixes several busiest-panel summary/detail strings to use the plugin domain.
panellib/analyze.php Fixes remaining analyze-panel tooltips/labels/status strings to use the plugin domain.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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