[wp-trac] [WordPress Trac] #52656: Inconsistency in the name of the .mo file that is expected by a theme and plugin

WordPress Trac noreply at wordpress.org
Thu Feb 25 15:07:28 UTC 2021


#52656: Inconsistency in the name of the .mo file that is expected by a theme and
plugin
-------------------------+-----------------------------
 Reporter:  sudar        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  I18N         |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Plugins and themes have a (very similar) way to load additional .mo files
 that are specific to them.


 For plugins we can use the
 [https://developer.wordpress.org/reference/functions/load_plugin_textdomain/
 load_plugin_textdomain] function and for themes we can use the
 [http://developer.wordpress.org/reference/functions/load_theme_textdomain
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52656>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list