[wp-trac] [WordPress Trac] #40392: load_textdomain() fails to merge in additional translations

WordPress Trac noreply at wordpress.org
Fri Apr 7 15:15:21 UTC 2017


#40392: load_textdomain() fails to merge in additional translations
--------------------------+-----------------------------
 Reporter:  muranyia      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  4.7.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I was initially investigating why I cannot load a supplementary
 translation for a plugin from a template using `load_plugin_textdomain()`,
 for which the function reference claims that ''"If you call
 load_plugin_textdomain multiple times for the same domain, the
 translations will be merged."''.

 At the end it seems to me that it is `load_textdomain()` that fails to
 merge in the additional translations. Interestingly the function reference
 says ''"If the domain already exists, the inclusion will fail."'', however
 in source:tags/4.7.3/src/wp-includes/l10n.php#L589 `merge_with()` is
 called, with the clear intention of merging the new translation with the
 old one.
 My observation is that the merging does not happen, and only one
 translation can be effective at a time.

 According to my tests, using an ordinary assignment (`=`) instead of a
 referential assignment (`=&`) at source:tags/4.7.3/src/wp-
 includes/l10n.php#L593 solves this problem.

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


More information about the wp-trac mailing list