[wp-trac] [WordPress Trac] #37819: _load_textdomain_just_in_time() is really not nice with alternative translations

WordPress Trac noreply at wordpress.org
Thu Aug 25 06:46:41 UTC 2016


#37819: _load_textdomain_just_in_time() is really not nice with alternative
translations
--------------------------+-----------------------------
 Reporter:  imath         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi there,

 First i'm sorry i haven't noticed this annoying behavior before.

 Then i'll try to explain my concern about
 `_load_textdomain_just_in_time()`.

 If i understood correctly #34114 :
 - it's there to ease life to plugin developer as they don't have to use
 `load_plugin_textdomain()` if they don't include translations anymore in
 their plugins.
 - It's also there to make sure a translation is loaded for a given domain
 if found in `WP_LANG_DIR` plugins/themes.
 - it improves performance.

 All 3 points are great. But sometimes it's important for a company (like
 it is for the one i work for) to be able to use alternative translations.
 To do so, some plugins like BuddyPress first look into
 `WP_LANG_DIR/buddypress` before the regular locations. In this folder it's
 possible for users to drop an alternative translation. It's really
 important because for instance, you cannot use "friends" in a company it
 doesn't make sense at all.

 Now that `_load_textdomain_just_in_time()` is there, the alternative
 translation is not loading anymore. The `WP_LANG_DIR/plugins/buddypress-
 fr_FR.mo` is always used. I've read #37113 and although i agree for a
 plugin developer it's a way to fix the issue, when you are a site owner
 with a lot of plugins, it's not great at all.

 To me being able to use an alternative translation is almost as much
 important as having a plugin translated. It's a really important feature.

 And in a way this feature is broken since 4.6 :(

 Of course i easily found a way to solve my trouble using some filters. But
 regular corporate site owners could hesitate to upgrade if they loose
 their alternative translations...

 It looks like using the `Translations::merge_originals_with()` method
 instead of `Translations::merge_with()` for these particular cases is
 fixing the annoying behavior.

 See suggested patch attached to this ticket.

 Thanks for your comprehension.

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


More information about the wp-trac mailing list