[wp-trac] [WordPress Trac] #60234: Modules API: Add a translations API

WordPress Trac noreply at wordpress.org
Thu Jan 11 15:14:58 UTC 2024


#60234: Modules API: Add a translations API
---------------------------+-----------------------------
 Reporter:  luisherranz    |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  javascript     |
---------------------------+-----------------------------
 Now that WordPress is going to support native ES modules through the new
 [https://core.trac.wordpress.org/ticket/56313 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60234>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list