meteor-messageformat
MessageFormat support, the Meteor way.
For iron:router < 1.0.0, use messageformat v0.0.45.
For Meteor < 0.8.0, use messageformat v0.0.26.
Easy reactive use of complicated strings (gender, plural, etc) with insanely easy translation into other languages (through a web UI).
For full info, docs and examples, see the
Meteor MessageFormat home page
(or install/clone the smart package and run mrt
in its website
directory).
In short, you'll get to use the {{mf}}
helper. Simple example:
1<p>{{mf 'trans_string' 'This string is translatable'}}</p>
but much more complex strings are possible, and are useful even if your website is only available in one language, e.g.:
1{{#mf KEY='gender_plural' GENDER=getGender NUM_RESULTS=getNum NUM_CATS=getNum2}} 2{GENDER, select, 3 male {He} 4 female {She} 5 other {They} 6 } found {NUM_RESULTS, plural, 7 =0 {no results} 8 one {1 result} 9 other {# results} 10 } in {NUM_CATS, plural, 11 one {1 category} 12 other {# categories} 13 }. 14 {{/mf}}
Possible outputs:
1He found 2 results in 1 category. 2She found 1 result in 2 categories. 3etc
Besides gender, there is support for offsets too, e.g.:
1You and one other person added this to their profile.
For full info, docs and examples, see the
Meteor MessageFormat home page
(or install/clone the smart package and run mrt
in its website
directory).