开发者

Where are the English pluralization rules for ActiveSupport defined?

I found the ActiveSupport infl开发者_运维知识库ector class. Where can I find the code that initializes the inflector for English?


The ActiveSupport inflector.rb file includes all the inflection libraries and modules.

If you want to customize it, there's a file called inflections.rb in your Rails config/initializers path.

By default it contains

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
#   inflect.plural /^(ox)$/i, '\1en'
#   inflect.singular /^(ox)en/i, '\1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
# end

You can edit it to customize the Inflector behavior.


The English rules are in ActiveSupport (specifically in lib/active_support/inflections.rb).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜