Repository navigation
🐛 fix(i18n): load the plugin's own Text Domain, default and trim the Domain Path - #148
Merged
Merged
Conversation
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.
Plugin::_init()loaded the translations with the literal'wp-kirk', whichbones renamerewrites in each plugin's vendor copy to the slug it derives from the plugin name. It only worked when that slug equals the plugin'sText Domainheader: add-browser-search (wp-abs), flash-feed-scroll-reader and wp-chooseyourtheme each had to load their own catalogue.DomainPathwas also read without a guard (undefined-index notice with no header) and its leading slash, which WordPress documents, was kept.New
Plugin::loadTextDomain()(called from_init(), still oninit): the header'sText Domainwhen present, else the'wp-kirk'literal (so a renamed copy without a header keeps working);Domain Pathdefaults tolanguages, slashes trimmed.Proof
PluginTextDomainTest: 6 cases (header wins, no header, empty header, no Domain Path, empty Domain Path, leading/trailing slash); red (6 errors) before, green after. Suite 404 tests / 1114 assertions..claude/scripts/textdomain-live-smoke.shon the WordPress 7.2-RC3 folder in a local Playground, it_IT, WP_DEBUG on, debug.log empty: a copy of add-browser-search (Text Domain add-browser-search, vendor slug wp-abs, its own load_plugin_textdomain call disabled) shows "Settings" on v3.4.0 and "Impostazioni" with this branch; Scotty (Text Domain = slug) shows "Impostazioni" before and after. Scotty vendors 2.1.2, whose Plugin.php cannot be swapped for the 3.4 file, so the same change was applied in place there.