[wp-trac] [WordPress Trac] #21319: is_textdomain_loaded() returns true even if there are no translations for the domain

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 20 07:25:41 UTC 2012


#21319: is_textdomain_loaded() returns true even if there are no translations for
the domain
------------------------------+-------------------------
 Reporter:  nacin             |       Owner:  nbachiyski
     Type:  defect (bug)      |      Status:  accepted
 Priority:  normal            |   Milestone:  3.5
Component:  I18N              |     Version:  3.0
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+-------------------------
Changes (by nbachiyski):

 * status:  reviewing => accepted


Comment:

 Looking at #10527 and the usage of the function I think it's just a matter
 of semantics.

 I think that even if there wasn't a valid MO file, or it didn't contain
 any translations, we still should consider the textdomain loaded. The
 purpose of the function is to prevent unwanted expensive double loading of
 translation files, not to check whether we have actual translations.

 I agree that the phpdoc is misleading and we should definitely fix that.

 If you, for whatever reason, need a function to check if a textdomain
 loaded actual MO file, we could have another function for that, but I
 don't see a use case for it for now.

 I am not a big fan of the micro-optimization.  First, it makes
 {{{get_translations_for_domain()}}} harder to read and inverses the logic
 there. The most common case: {{{return $l10n[ $domain ];}}} is buried in
 the middle of the function deeper intended than the rest of the function.
 Second, we usually have just a handful of textdomains and the noop class
 is very small, so I don't see the point.

 I

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21319#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list