🐼 Mandarin Chinese Inflections
This repository contains the complete and definitive set of Mandarin Chinese singularization and pluralization rules for Rails.
Installation
Add the following to your application's Gemfile:
gem 'mandarin_chinese_inflections'
And then execute:
$ bundle
Usage
To inflect strings in different locales:
'dumpling'.pluralize(:en)
'饺子'.pluralize(:zh)
Is this really the complete set of inflection rules?
Yes, this is the complete and definitive set of inflection rules for Mandarin Chinese.
I am very upset that the English inflection file is still incomplete after all these years. They simply aren't trying hard enough!
If you are new to Mandarin Chinese, I have provided a short comparison of inflections in English and Mandarin Chinese below.
Inflection in English and Mandarin Chinese
English
| 🥢 | 🍜 | 🥟 |
---|
Singular | chopstick | bowl | dumpling |
Plural | chopsticks | bowls | dumplings |
Mandarin Chinese
| 🥢 | 🍜 | 🥟 |
---|
Singular | 筷子 | 碗 | 饺子 |
Plural | 筷子 | 碗 | 饺子 |
Rails < 4.0.0
ActiveSupport 4 added the multilingual Inflector to Rails. If you are running an older version of ActiveSupport, you will need to upgrade your version of Rails to enjoy the joke.
Contributing
This is the complete and definitive inflection gem for Mandarin Chinese. No further contributions are required, thank you. 😛
Made by @dondonz. See more at failscasts.com.