[wp-trac] [WordPress Trac] #20491: Introduce some JavaScript i18n functions
WordPress Trac
noreply at wordpress.org
Fri Sep 23 16:11:06 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 jdgrimes):
I don't know if this has been mentioned, but in regard to `sprintf()`: in
JS that is already using Underscores anyway, it is possible to use
Underscores templates to do this. I have done this before.
{{{#!php
$text = sprintf( __( 'String with %s.' ), '{{placeholder}}' );
}}}
{{{#!js
var text = wp.template( l10nTemplateFromPHP, value );
}}}
(Just a POC from off the top of my head.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/20491#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list