[3.0] Look language strings up under the name they are stored with - #9397
Open
albertlast wants to merge 1 commit into
Open
[3.0] Look language strings up under the name they are stored with#9397albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
Lang::getTxt() takes a file: argument naming the language file the string lives in, loads it, and returns an empty string when the key still is not there. Nine calls name a file that does not define the key they ask for. Where the right file happens to be loaded by something else on that page, the lookup survives; where it is not, the string comes back empty. Two are certainly empty: - MarkdownParser asked for quote_expand, which is the *admin setting* "Minimum quote height to add an expand link on large quotes", and lives in Admin. The label wanted is code_expand. Since the value ends up in data-expand-txt and script.js only builds the button when that attribute has a value, a fenced code block in Markdown never got its Expand button. - ThemeOptions asked for 'THemes', with a capital H, so on a case sensitive filesystem no file is loaded at all. The rest name a real file that simply does not hold the string: the two theme option headings are in Profile (as the same two calls in ThemeOptions already say), invalid_credentials and edit_history_count are in General, error_string_too_long is in Search, token_verify_fail is in Errors, and edit_language_entries_add is in ManageSettings. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This was referenced Aug 8, 2026
Closed
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.
Description
Lang::getTxt()takes afile:argument naming the language file a string lives in. It loads that file, then looks the key up in the flatLang::$txtarray, and returns''when it is not there.Nine calls name a file that does not define the key they ask for. I found them by sweeping every
getTxt('key', …, file: 'Name')call against whatLanguages/en_US/*.phpactually defines.Where the right file happens to be loaded by something else on the same page, the lookup survives by luck. Where it is not, the string comes back empty. Two of these are certainly empty:
Sources/Parsers/MarkdownParser.phpasked forquote_expand. That is the admin setting label "Minimum quote height to add an expand link on large quotes", and it lives inAdmin, notGeneral. The label wanted iscode_expand. The value is substituted intodata-expand-txt, andattachBbCodeEvents()inscript.jsonly builds the button when that attribute has a value — so a fenced code block in Markdown never got its Expand button.Sources/Actions/Profile/ThemeOptions.phpasked forfile: 'THemes', with a capital H. On a case sensitive filesystem no file is loaded at all.The rest name a real file that simply does not hold the string:
Actions/Admin/Themes.phptheme_opt_variantActions/Admin/Themes.phptheme_opt_colormodeActions/Login2.php(×2)invalid_credentialsActions/Search.phperror_string_too_longMaintenance/Tools/Upgrade.phptoken_verify_failThemes/default/ManageLanguages.template.phpedit_history_count…edit_language_entries_addThemes/default/Register.template.php(×2)edit_history_countThe two theme option headings are worth pointing out: the same two strings are fetched in
Actions/Profile/ThemeOptions.php, and those calls already sayfile: 'Profile'. The admin side just disagrees with the profile side.What I checked, and what I did not
edit_language_entries_addbutton does render today ("Add another item" on Admin → Languages → Edit → Modifications), because the admin area loadsManageSettingsfor its own reasons. It is still naming the wrong file — it works by accident.invalid_credentials,edit_history_countanderror_string_too_longare the same shape:Generalis always loaded, andSearchis loaded on the search page.theme_variants/has_dark_mode, and the default theme sets neither, so that branch does not run on a stock install and I could not exercise it. The evidence is the language files themselves plus the disagreeing sibling calls.token_verify_failneeds a failed token in the upgrader; I did not stage that.The sweep script is 60 lines and finds this class of mistake with no false positives once concatenated keys (
getTxt('icon_' . $x, …)) are excluded. Happy to contribute it as a CI step alongside the unimported-class check offered in #9395 if that is wanted — neitherphplintnorphp-cs-fixercan see this, and the failure is silent rather than loud.Found while splitting #7933; this is not part of the theme itself, so it goes straight to
release-3.0.Issues References (Fixes|Related|Closes)
Related to #7933