[wp-trac] [WordPress Trac] #20491: Introduce some JavaScript i18n functions

WordPress Trac noreply at wordpress.org
Mon Mar 26 10:32:38 UTC 2018


#20491: Introduce some JavaScript i18n functions
--------------------------------------+-----------------------------------
 Reporter:  johnbillion               |       Owner:  swissspidy
     Type:  enhancement               |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.0
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript, rest-api
--------------------------------------+-----------------------------------
Changes (by ocean90):

 * milestone:  Future Release => 5.0


Comment:

 Links to some relevant Gutenberg resources:

 * JavaScript API:
 https://github.com/WordPress/gutenberg/blob/v2.4.0/i18n/index.js
 * Translations to Jed-format:
 https://github.com/WordPress/gutenberg/blob/v2.4.0/lib/i18n.php#L12-L40
 * PHP to JavaScript:
 https://github.com/WordPress/gutenberg/blob/v2.4.0/lib/client-
 assets.php#L851-L857
 * String extraction:
 https://github.com/WordPress/gutenberg/blob/v2.4.0/i18n/babel-plugin.js

 (Would `wp.i18n` be something for https://github.com/WordPress/packages?)

 ----

 I think the remaining task is how and which translations we want to load
 into Jed?
 Looks like it can be a separate JSON file per text domain or a po/mo file
 per "sub text domain" for the JS files. The second option would be similar
 to what Gutenberg is currently doing with `get_translations_for_domain()`.
 A "sub text domain" could be `gutenberg-editor` for the JavaScript part
 while `gutenberg` is used for strings in PHP. Are there other options?
 What else is missing?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20491#comment:82>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list