#38788 closed enhancement (fixed)
Make get_available_languages() filtrable
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.7 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | I18N | Keywords: | has-patch |
| Focuses: | Cc: |
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)
#4
@
9 years ago
- Milestone changed from Awaiting Review to 4.7
- Owner set to pento
- Status changed from new to assigned
#5
follow-up:
↓ 7
@
9 years ago
- Resolution set to fixed
- Status changed from assigned to closed
In 39235:
#7
in reply to:
↑ 5
;
follow-up:
↓ 8
@
9 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
@
9 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