#57056 closed enhancement (fixed)
Pass $locale to override_load_textdomain filter
| Reported by: | ocean90 | Owned by: | audrasjb |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.2 |
| Component: | I18N | Version: | 6.1 |
| Severity: | normal | Keywords: | good-first-bug has-patch commit |
| Cc: | Focuses: |
Description
In [53874] the $locale parameter was added to load_textdomain() so it can be used to properly fill WP_Textdomain_Registry.
Since the $locale may not be the same value as determine_locale() returns (e.g. when filtered by plugin_locale in load_plugin_textdomain()) we should also pass the new parameter to the filter so custom file loading implementations are using the same locale as load_textdomain() got.
Change History (13)
This ticket was mentioned in PR #3600 on WordPress/wordpress-develop by @cadic.
4 years ago
#1
- Keywords has-patch added; needs-patch removed
#3
@
4 years ago
- Milestone Future Release → 6.2
Adding to 6.2 milestone as initial PR updated from some code review feedback, needs final testing before readying for commit.
This ticket was mentioned in Slack in #core by costdev. View the logs.
4 years ago
@SergeyBiryukov commented on PR #3600:
4 years ago
#6
Would it make sense to move the locale detection earlier in the function, so that it's always passed as a string to the filter, instead of string|null?
if ( ! $locale ) {
$locale = determine_locale();
}
@swissspidy commented on PR #3600:
4 years ago
#7
IIRC that get_locale() call is deliberately as late as possible to avoid too many calls for performsnce reasons.
#8
@
4 years ago
- Keywords changes-requested removed
This ticket was discussed during the recent bug scrub. As all feedback on the PR has been addressed, I'm removing the changes-requested keyword.
This ticket was mentioned in Slack in #core by costdev. View the logs.
4 years ago
#10
@
4 years ago
- Keywords commit added
This ticket was discussed during the bug scrub. As the patch only adds a new parameter to a filter, this should not need testing. Adding for commit consideration.
@audrasjb commented on PR #3600:
4 years ago
#13
committed in https://core.trac.wordpress.org/changeset/55196
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In [53874] the
$localeparameter was added toload_textdomain()so it can be used to properly fillWP_Textdomain_Registry.Since the
$localemay not be the same value asdetermine_locale()returns (e.g. when filtered byplugin_localeinload_plugin_textdomain()) we should also pass the new parameter to the filter so custom file loading implementations are using the same locale asload_textdomain()got.Trac ticket: https://core.trac.wordpress.org/ticket/57056