#38788 closed enhancement (fixed)
Make get_available_languages() filtrable
| Reported by: | yoavf | Owned by: | pento |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | I18N | Version: | 4.7 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description (last modified by )
When a user object is saved using edit_user() (i.e, after editing the user settings) WP will discard (and replace with en_US) any submitted value for the new user locale meta if it is not part of the array returned by get_available_languages()
get_available_languages() works by scanning the language folder for .mo files. In some use cases, language files might not exist for a locale, named in a different way, or maybe stored elsewhere. get_available_languages() results should be filtrable.
FWIW: we need this filter (or an alternate solution) to merge the new user locale setting and locale switching to WP.com.
Attachments (1)
Change History (11)
#7
in reply to: ↑ 5
;
follow-up:
↓ 8
@
10 years ago
Replying to pento:
Sometimes, a language file may not exist in exactly the format or location that get_available_languages() expects it to be in
For this case, wouldn't it make more sense to have a pre_get_available_languages filter instead?
#8
in reply to: ↑ 7
@
10 years ago
Replying to ocean90:
For this case, wouldn't it make more sense to have a
pre_get_available_languagesfilter instead?
Either works, I think. @yoavf is doing the migration, so I went with his recommendation.
See also #38590, #29892