[wp-trac] [WordPress Trac] #26746: Avoid translating several times post type and taxonomy default labels
WordPress Trac
noreply at wordpress.org
Mon Apr 4 03:48:25 UTC 2022
#26746: Avoid translating several times post type and taxonomy default labels
-------------------------------------------------+-------------------------
Reporter: Chouby | Owner:
| SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.0
Component: Posts, Post Types | Version: 3.0
Severity: normal | Resolution: fixed
Keywords: has-patch early commit needs-dev- | Focuses:
note | performance
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"53058" 53058]:
{{{
#!CommitTicketReference repository="" revision="53058"
Posts, Post Types; Taxonomy: Translate default labels once.
Improve the translation of post type and taxonomy labels by caching the
translations during runtime. To account for internationalisation plugins,
the runtime cache is cleared as the post types/taxonomies are reinitiated
on `change_local` hook.
The same property and methods are added to both `WP_Post_Type` and
`WP_Taxonomy`:
* `$default_labels`: for storing the translated strings at runtime
* `get_default_labels()`: for getting the default labels, these are
translated on the first run and stored in the new property.
* `reset_default_labels()`: to clear the runtime cache and force a re-
translation of the default labels
Props Chouby, nacin, SergeyBiryukov, Rarst, chriscct7, ocean90, audrasjb,
costdev.
Fixes #26746.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26746#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list