Ticket #19852 (closed task (blessed): fixed)
Don't load admin strings on the frontend
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | I18N | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | scribu, ocean90, pavelevap@…, frederic.demarle@… |
Description
We should take the same approach as we did for multisite strings, and only load admin strings in the admin.
This should be handled in load_default_textdomain(). Additionally, includes/admin.php should load the admin mo file if it is not already loaded, in the case of the frontend calling on the admin bootstrap (which we, for example, do in admin-ajax).
This came out of #19832.
Attachments
Change History
Patch (totally untested) creates frontend, site admin, network admin, and user admin pots. The ms pot is dropped since it accounts for so few strings. The continents-cities pot is preserved.
Here are the new pots and their corresponding number of lines. The user admin pot has only two translatable strings.
- wordpress-network-admin.pot: 1122
- wordpress-site-admin.pot: 10634
- wordpress-user-admin.pot: 20
- wordpress.pot: 6701
> grep msgid wordpress-site-admin.pot | wc -l 2460
A fair number of strings. 1552 for wordpress.pot and 259 for wordpress-network-admin.pot.
I think that there will be special textdomain needed, which have to be manually added to particular strings?
Example:
wp-includes/general-template.php:
1) function register_admin_color_schemes() - contains strings for administration.
2) function get_search_form() - contains strings for frontend.
And other problem: Some general strings are same for frontend and backend, for example "Comments", etc. So, there will be need for adding them to both textdomain files.
The pots will be merged where necessary. Network admin, for example, will load and merge wordpress-network-admin.pot, wordpress-site-admin.pot, and wordpress.pot.
comment:10
nacin — 5 weeks ago
Let's reduce it by one and end up with wordpress.pot, wordpress-admin.pot, and wordpress-admin-network.pot?
comment:11
in reply to:
↑ 8
nacin — 5 weeks ago
Replying to pavelevap:
1) function register_admin_color_schemes() - contains strings for administration.
All strings in wp-includes will be included in the main wordpress.pot, regardless of intended use. It won't add up to much.
And other problem: Some general strings are same for frontend and backend, for example "Comments", etc. So, there will be need for adding them to both textdomain files.
As there will be a hierarchy of includes (wordpress.pot is always included, wordpress-admin.pot is always included in the site/network/user admins, etc.) we can keep the string in only one pot, whichever is the superset.
comment:12
pavelevap — 5 weeks ago
But then there will be also many strings from admin loaded on frontend. Main purpose of this ticket was to minimize strings loaded on frontend. And now there will be also mess for translators - some admin strings together with all frontend strings. There was another ticket related to multisite strings: http://core.trac.wordpress.org/ticket/19831
There is only one good way - marking all frontend strings manually with special textdomain, I guess.
comment:13
ryan — 5 weeks ago
The current makepot patch removes thousands of strings from the frontend pot. register_admin_color_schemes() and the handful of others that introduce backend only strings into the frontend are not worth worrying about.
-
attachment
19852-makepot.5.diff
added
User and site admin in same pot. Dupe removal for net admin pot.
comment:14
nbachiyski — 4 weeks ago
The patch looks good to me, except the call to non-existant $this->wp_user_admin($dir, null); in wp_core().
comment:16
ryan — 4 weeks ago
Next up is updating all of the potbot related scripts, creating new GlotPress projects for the new pots, and moving strings to the right projects.
-
attachment
19852.2.diff
added
ms- back compat. Load admin-network- instead of network-admin-
comment:17
ryan — 4 weeks ago
In [19772]:
comment:19
nacin — 3 weeks ago
In [19787]:
comment:20
nacin — 2 weeks ago
- Status changed from new to closed
- Resolution set to fixed
Next up is updating all of the potbot related scripts, creating new GlotPress projects for the new pots, and moving strings to the right projects.
We're all done here.

Here's a link to makepot.php for those not familiar with it:
http://i18n.trac.wordpress.org/browser/tools/trunk/makepot.php