[wp-trac] [WordPress Trac] #22229: Plurals in JavaScript
WordPress Trac
noreply at wordpress.org
Tue Oct 23 15:12:13 UTC 2012
#22229: Plurals in JavaScript
-------------------------+------------------
Reporter: nacin | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.5
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------
Comment (by nacin):
Replying to [comment:3 scribu]:
> Ok, so instead of generating a new JS function for each string, how
about we make a single generic JS function that gets run for all the
strings? Something like the following:
>
> {{{
> wp.i18n._n(exampleL10n.numItems, 5);
> }}}
I've been playing around with different syntaxes but couldn't get it just
right. This looks interesting, though I agree with nikolay that the pretty
function syntax is quite nice. The patch was definitely written as a
temporary rush-plurals-into-JS solution, not an API that would stand the
test of time.
The main thing I couldn't figure out was where wp.i18n would live. A new
file that is a dependency of common.js? If we print the plural expression
through script-loader, we'd have to then eval() it, because it's an
expression, not a string. So, we probably have to print it via some other
means.
I'm curious what you see the role of NOOP_Gettext_Translations as. That
would be used in place of NOOP_Translations, I imagine?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22229#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list