#52656 closed enhancement (duplicate)
Inconsistency in the name of the .mo file that is expected by a theme and plugin
Reported by: | sudar | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.7 |
Component: | I18N | Keywords: | |
Focuses: | Cc: |
Description
Plugins and themes have a (very similar) way to load additional .mo files that are specific to them.
For plugins we can use the load_plugin_textdomain function and for themes we can use the load_theme_textdomain function.
But the expected name of the .mo file differ between the theme and plugin.
Plugins expect them to have the name {text-domain}-{locale}.mo
(relevant code https://github.com/WordPress/WordPress/blob/master/wp-includes/l10n.php#L896) and themes expect them to have the name {locale.mo}
(relevant code https://github.com/WordPress/WordPress/blob/master/wp-includes/l10n.php#L964).
It would be nice to have a consistent naming convention between theme and plugin or at least provide a way to override the expected .mo file name using a filter.
If there is a preferred way, then I can submit a patch.
Attachments (1)
Change History (4)
#2
in reply to:
↑ description
@
4 years ago
Thanks for the ticket!
Replying to sudar:
It would be nice to have a consistent naming convention between theme and plugin or at least provide a way to override the expected .mo file name using a filter.
As noted above, this was improved for files loaded from the wp-content/languages
directory in [37414] / #34213, they all have a consistent name of {text-domain}-{locale}.mo
.
You can also use the load_textdomain_mofile filter to override the expected .mo
file name.
If you try a fresh WordPress-installation (where initial installation was WordPress 4.6 or later), you'll probably see that what you ask for has already been implemented.
I'll upload an image to show what I see on my test site.