fix(i18n): pass the intropage text domain on 51 display strings - #374
Open
somethingwithproof wants to merge 1 commit into
Open
fix(i18n): pass the intropage text domain on 51 display strings#374somethingwithproof wants to merge 1 commit into
somethingwithproof wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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
intropagetext 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
locales/poships 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.pocarries:while
display.phpasked 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_roleswith__('Normal User')and__('System Administration')in the core catalog (include/global_arrays.php:1266), andauth_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 attachintropage.phpandintropage_admin.phpto 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:
No behavior change for an English install.