Opened 13 months ago
Last modified 12 months ago
#60234 new enhancement
Script Modules API: Add a translations API
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | |
Focuses: | javascript | Cc: |
Description
Now that WordPress is going to support native ES modules through the new Modules API, we should start discussing possible translation APIs to support internationalization/localization, similar to what wp_set_script_translations
provides for the Scripts API.
Some of the initial considerations are:
- It should support the dynamic loading of translations when used in conjunction with dynamic imports (
import()
) to avoid downloading all the translations on page load. - Ideally, it should download the translations required in the initial page load in parallel to avoid waterfalls on page load.
- Ideally, it should rely only on available PHP and JavaScript APIs, and not require any specific tooling.
- Ideally, the APIs should be as transparent as possible to the developers.
Please share your opinions and ideas. Let's use this ticket for discussion.
Change History (2)
Note: See
TracTickets for help on using
tickets.
This is related to and may depend on #60647 which would make
wp-i18n
functionality available to script modules.