[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
Mon Jul 30 16:19:02 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 |
------------------------------+-------------------------
Comment (by nbachiyski):
> It's actually not a micro-optimization.
Got it, you're right. If we go this route, we would need something like
this. The static would be much harder to test and I would go with a global
noop instance, but that's a detail.
I think we should have two different functions for checking whether the
loading phase is done and whether we actually loaded a translations file.
I agree about the naming inconsistency. We should think of better names
for these functions.
> if a double-loading were to occur with the first one not finding a MO
file, it would still trigger an expensive {{{merge_with()}}}
It won't be expensive. When we load the domain we merge the current
translations onto the new ones, so if the current is empty/noop it will be
fast. But, of course, free is better than cheap, so the change would be
good.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21319#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list