[wp-trac] [WordPress Trac] #20491: Introduce some JavaScript i18n functions
WordPress Trac
noreply at wordpress.org
Wed Sep 21 21:08:10 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 ocean90):
Replying to [comment:35 swissspidy]:
> Besides that, I'm still tinkering with the patch to find the best way to
load the translation files. We could load the JSON files in PHP and use
`wp_add_inline_script` to initialize them or we could also fetch them via
Ajax (think `wp.i18n.load_textdomain()`).
That sounds interesting but for v1 we should load them via
`wp_add_inline_script()`. Loading strings asynchronously sounds
complicated. :)
[attachment:20491.5.diff]:
* It looks like the JS minify task ignores the `@preserve` tag in the file
header.
* Is `numberFormat()` compatible with WordPress' license? There is a
`@license See CREDITS.md` tag but the file doesn't exist.
* 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 )`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/20491#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list