dust-intl icon indicating copy to clipboard operation
dust-intl copied to clipboard

support numeric tokens (params prefixed with `v`)

Open drewfish opened this issue 10 years ago • 6 comments

drewfish avatar Mar 10 '14 16:03 drewfish

hmm, can you elabore more on this @drewfish?

caridy avatar Mar 10 '14 17:03 caridy

@caridy the details are in the trello card "support numeric replaces like {0}"

redonkulus avatar Mar 10 '14 17:03 redonkulus

Is this common for Dust helper libs to do with unnamed params?

If not, then this seems out of the scope of what this package should support. Unnamed params seem less ideal than named params because they would suffer from the same ambiguity as boolean params (e.g., foo('bar', true, true, false, true)).

I think if this translation of argument index to argument name needs to happen, it should be inside the app code base.

ericf avatar Mar 11 '14 17:03 ericf

@caridy @ericf what do we want do with this one? We have many developers that use this functionality in our own helper. Example:

"MAKE_YAHOO_YOUR_HP": "Make {0}Yahoo!{1} your homepage"

{@i18n_string _key="MAKE_YAHOO_YOUR_HP" v0="<i class='yhoo-logo Va-m img-sprite TextHidden D-ib'>" v1="</i>" /}

Final output would be:

Make <i class='yhoo-logo Va-m img-sprite TextHidden D-ib'>Yahoo!</i> your homepage

We need to pass this into the string so that translators can format it properly.

/cc @willthai

redonkulus avatar Jun 12 '14 23:06 redonkulus

Last I heard (March 11th) from Rajiv:

I¹m going to see what I can do on our side to maybe pre process the {0}-style placeholders and get back to you.

drewfish avatar Jun 16 '14 02:06 drewfish

He was responding to an email where I suggested changing {0} into {v0} so that it is still called with {@i18n_string v0=...}.

drewfish avatar Jun 16 '14 02:06 drewfish