Respect plugin's Domain Path when looking for translations for scripts#9792
Respect plugin's Domain Path when looking for translations for scripts#9792USERSATOSHI wants to merge 6 commits intoWordPress:trunkfrom
Domain Path when looking for translations for scripts#9792Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
jsnajdr
left a comment
There was a problem hiding this comment.
This patch looks good and it solves the issue: I tested it on my local plugin setup where I originally discovered it and the plugin-local translations that were originally missed are now loaded.
Thank you for fixing it so quickly 🚀
Summary
load_script_textdomain()did not consult a textdomain's registeredDomainPath(the custom path set byload_plugin_textdomain()/ the plugin header). As a result, JS translations required an explicit$pathtowp_set_script_translations()while PHP translations using__()honoredDomainPath.Changes
load_script_textdomain()now checks the registry path (if present) and tries loading translations from that path (human-readable filename first, then md5-hashed filename) before falling back toWP_LANG_DIRlookups.Trac ticket: https://core.trac.wordpress.org/ticket/63944
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.