如何用单词在轨道中复数?

时间:2017-06-13 14:32:33

标签: ruby-on-rails ruby rails-i18n

我想用数字而不是数字来复数翻译。

因此,例如,我希望能够获得导致以下结果的翻译:

"The Patriots came back to win the Superbowl by scoring thirty-one points in a row."

...而不是:

"The Patriots came back to win the Superbowl by scoring 31 points in a row."

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:4)

我认为你要找的是humanize

<ProgressBar className="right" active now={25}/>

或者在你的情况下:

2.humanize  # => "two"
4.humanize  # => "four"
8.humanize  # => "eight"