airbnb / polyglot.js

Give your JavaScript the ability to speak many languages.
http://airbnb.github.io/polyglot.js
BSD 2-Clause "Simplified" License
3.71k stars 208 forks source link

#59 Support smart count / value pairs for pluralize #60

Closed SebastianTimofte closed 8 years ago

SebastianTimofte commented 8 years ago

Implemented support for smart_count objects with count/value pairs Updated unit tests to check the new feature Updated the documentation to reflect the new feature

SebastianTimofte commented 8 years ago

Hey guys,

This PR is related to this issue: https://github.com/airbnb/polyglot.js/issues/59

SebastianTimofte commented 8 years ago

Epiphany moment... this change makes absolutely no sense since you can do

polyglot.extend({ "num_cars": "%{count} car |||| %{count} cars", });

And then

`polyglot.t("num_cars", {smart_count: 0, count: "Zero"}); => "Zero cars"

polyglot.t("num_cars", {smart_count: 1, count: "One"}); => "One car"

polyglot.t("num_cars", {smart_count: 2, count: "Two"}); => "Two cars"`

Nowhere does the plugin enforce using smart_count for interpolation as well...

Please close the PR since it is redundant and thank you for all your help :)