- 31 7月, 2012 1 次提交
-
-
由 David Celis 提交于
The Inflector is currently not very supportive of internationalized websites. If a user wants to singularize and/or pluralize words based on any locale other than English, they must define each case in locale files. Rather than create large locale files with mappings between singular and plural words, why not allow the Inflector to accept a locale? This patch makes ActiveSupport::Inflector locale aware and uses `:en`` unless otherwise specified. Users will still be provided a list of English (:en) inflections, but they may additionally define inflection rules for other locales. Each list is kept separately and permanently. There is no reason to limit users to one list of inflections: ActiveSupport::Inflector.inflections(:es) do |inflect| inflect.plural(/$/, 's') inflect.plural(/([^aeéiou])$/i, '\1es') inflect.plural(/([aeiou]s)$/i, '\1') inflect.plural(/z$/i, 'ces') inflect.plural(/á([sn])$/i, 'a\1es') inflect.plural(/é([sn])$/i, 'e\1es') inflect.plural(/í([sn])$/i, 'i\1es') inflect.plural(/ó([sn])$/i, 'o\1es') inflect.plural(/ú([sn])$/i, 'u\1es') inflect.singular(/s$/, '') inflect.singular(/es$/, '') inflect.irregular('el', 'los') end 'ley'.pluralize(:es) # => "leyes" 'ley'.pluralize(:en) # => "leys" 'avión'.pluralize(:es) # => "aviones" 'avión'.pluralize(:en) # => "avións" A multilingual Inflector should be of use to anybody that is tasked with internationalizing their Rails application. Signed-off-by: NDavid Celis <david@davidcelis.com>
-
- 21 6月, 2012 1 次提交
-
-
由 Godfrey Chan 提交于
This is a follow up to #4719. It appears that singularize and pluralize are supposed to be idempotent - i.e. when you call singularize or pluralize multiple times on the same string, you should get the same result. (At least for the "officially supported" cases that the stock inflector is designed to handle.) #4719 added the missing tests for regular cases, and this commit added the missing tests for the irregularities. While I'm at that, I also synced up the irregularity test cases with the current set of irregularity cases that we ship out-of-the-box.
-
- 25 2月, 2012 1 次提交
-
-
由 Xavier Noria 提交于
Trying alternative implementations of the inflections is hard because the suite is coupled with the current one, setting ivars by hand etc. This commit relies on initialize_dup, as long as you maintain that one you can tweak the implementation.
-
- 04 2月, 2012 1 次提交
-
-
由 Tim Gildea 提交于
-
- 27 1月, 2012 1 次提交
-
-
由 Mark McSpadden 提交于
Add Inflection test (and fixes) to ensure singularizing a singular actually give you the correct singular in more cases
-
- 06 1月, 2012 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 30 10月, 2011 1 次提交
-
-
由 Xavier Noria 提交于
This commit also implements a faster version of #demodulize I was unable to isolate with git add --patch. Not a big fan of the name #deconstantize. It complements #demodulize getting rid of the rightmost constant, hence the name, but it is unrelated to the well-known #constantize. So unsure. Could not come with anything better, please feel free to rename.
-
- 29 10月, 2011 1 次提交
-
-
由 Xavier Noria 提交于
This is also faster on 1.9.
-
- 23 9月, 2011 1 次提交
-
-
由 Ryan Oblak 提交于
Added ActiveSupport::Inflector.safe_constantize and String#safe_constantize; refactored common constantize tests into ConstantizeTestCases
-
- 09 9月, 2011 1 次提交
-
-
由 José Valim 提交于
-
- 08 9月, 2011 1 次提交
-
-
由 Damien Mathieu 提交于
-
- 11 6月, 2011 2 次提交
- 25 4月, 2011 1 次提交
-
-
由 Stefan Huber 提交于
-
- 01 3月, 2011 1 次提交
-
-
由 Sam Elliott 提交于
[#6490 state:committed] Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
-
- 17 2月, 2011 1 次提交
-
-
由 Dan Pickett 提交于
[#6363] Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
-
- 22 12月, 2010 2 次提交
-
-
由 Piotr Sarnacki 提交于
-
由 John Paul Ashenfelter 提交于
Added a word boundary to uncountable inflection regex for #singularize so short inflections like ors do not affect larger words like sponsors [#6093 state:resolved]
-
- 20 5月, 2010 1 次提交
-
-
由 Santiago Pastorino 提交于
Signed-off-by: NJosé Valim <jose.valim@gmail.com>
-
- 10 8月, 2009 1 次提交
-
-
由 Prem Sichanugrist 提交于
Fix that irregular plural inflections should not be double-pluralized: 'people'.pluralize should return 'people' not 'peoples'. [#1183 state:committed] Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
-
- 02 7月, 2009 1 次提交
-
-
Signed-off-by: NYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
-
- 23 4月, 2009 1 次提交
-
-
由 Jeremy Kemper 提交于
-
- 11 3月, 2009 1 次提交
-
-
由 Henrik N 提交于
Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
-
- 09 3月, 2009 1 次提交
-
-
由 Jeremy Kemper 提交于
[#1617 state:resolved]
-
- 16 12月, 2008 2 次提交
-
-
由 Jeremy Kemper 提交于
[#410 state:open] This reverts commit 262fef7e.
-
由 Frederick Cheung 提交于
[#410 state:resolved] Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
-
- 27 11月, 2008 1 次提交
-
-
由 Jeremy Kemper 提交于
-
- 23 9月, 2008 1 次提交
-
-
由 Adam Cigánek 提交于
Modified ActiveSupport::Inflector#parameterize with code from slugalizer (http://github.com/henrik/slugalizer) Handles trailing and leading slashes, and squashes repeated separators into a single character. Signed-off-by: NMichael Koziarski <michael@koziarski.com> [#1034 state:committed]
-
- 10 9月, 2008 2 次提交
-
-
由 David Heinemeier Hansson 提交于
Added Inflector#parameterize for easy slug generation ("Donald E. Knuth".parameterize => "donald-e-knuth") #713 [Matt Darby]
-
由 David Heinemeier Hansson 提交于
Added Inflector#parameterize for easy slug generation ("Donald E. Knuth".parameterize => "donald-e-knuth") #713 [Matt Darby]
-
- 24 8月, 2008 1 次提交
-
-
由 Peter Wagenet 提交于
Signed-off-by: NTarmo Tänav <tarmo@itech.ee>
-
- 22 8月, 2008 1 次提交
-
-
由 Amos King 提交于
Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
-
- 02 7月, 2008 1 次提交
-
-
由 Pratik Naik 提交于
Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
-
- 04 6月, 2008 1 次提交
-
-
由 Joshua Peek 提交于
Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [#238 state:resolved]
-
- 02 5月, 2008 1 次提交
-
-
由 Jeremy Kemper 提交于
-
- 05 1月, 2008 1 次提交
-
-
由 Jeremy Kemper 提交于
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-
- 02 10月, 2007 1 次提交
-
-
由 Jeremy Kemper 提交于
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-
- 27 9月, 2007 1 次提交
-
-
由 Jeremy Kemper 提交于
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-
- 23 9月, 2007 1 次提交
-
-
由 David Heinemeier Hansson 提交于
Fixed that pluralizing an empty string should return the same empty string, not "s" (closes #7720) [josh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7569 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-
- 24 6月, 2007 1 次提交
-
-
由 David Heinemeier Hansson 提交于
Added support for pluralization with a different starting letter than the singular version (cow/kine) (closes #4929) [norri_b/hasmanyjosh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7092 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-