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

WordPress Trac noreply at wordpress.org
Wed Sep 21 21:58:33 UTC 2016


#20491: Introduce some JavaScript i18n functions
--------------------------------------+-----------------------------
 Reporter:  johnbillion               |       Owner:  swissspidy
     Type:  enhancement               |      Status:  assigned
 Priority:  normal                    |   Milestone:  Future Release
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript
--------------------------------------+-----------------------------

Comment (by swissspidy):

 Replying to [comment:37 ocean90]:
 > Replying to [comment:35 swissspidy]:
 > * It looks like the JS minify task ignores the `@preserve` tag in the
 file header.

 That line's exactly like that in the original source. How does core
 preserve file headers in other JS files?

 > * Is `numberFormat()` compatible with WordPress' license? There is a
 `@license See CREDITS.md` tag but the file doesn't exist.

 Good question. I think in the last few patches I used different code than
 in the original patch, so that might not even be up to date anymore.

 > * I wonder if we should make `wp.i18n.sprintf()` public or if there
 should be a wrapper instead. Something like `wp.i18n.translate( 'Foo %1$s,
 %2$s', arg1, arg2 )` as an alternative for `wp.i18n.sprintf( wp.i18n.__(
 'Foo %1$s, %2$s', 'domain' ), arg1, arg2 )`.

 That sounds impossible with the optional domain param before the args, no?

 Also, `string.sprintf( arg1, arg2 )` might be more JavaScript-like, but
 ideally there should be a `wp.sprintf` utility method.

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


More information about the wp-trac mailing list