[wp-trac] [WordPress Trac] #38590: Don't use `get_available_languages()` in `_load_textdomain_just_in_time()`
WordPress Trac
noreply at wordpress.org
Mon Oct 31 11:34:09 UTC 2016
#38590: Don't use `get_available_languages()` in `_load_textdomain_just_in_time()`
--------------------------+----------------------------
Reporter: ocean90 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: I18N | Version: 4.6
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+----------------------------
`get_available_languages()` has been introduced in #11774 and is only
designed to work with translations for core IMO.
Since [37415] it's also used to retrieve translations in the plugin/theme
directory of `WP_LANG_DIR`.
`get_available_languages()` does three `strpos()` checks to prevent
returning language codes like `admin-zh_TW`, `continents-cities-zh_TW` or
`ms-zh_TW`.
Using `get_available_languages()` for plugins/themes will not return
language codes (see `@return` tag). It returns the text domain and the
language code of a file. But only if a plugin/theme doesn't start with
`admin-` or `ms-`.
Instead of using `get_available_languages()` in
`_load_textdomain_just_in_time()` a direct call to `glob()` should be
sufficient.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38590>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list