inflections 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +12 -16
- data/lib/inflections.rb +0 -2
- data/lib/inflections/version.rb +2 -2
- metadata +2 -8
- data/lib/inflections/en-GB.rb +0 -22
- data/lib/inflections/en.rb +0 -22
- data/test/en-GB_test.rb +0 -70
- data/test/en_test.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa5e44dd27069a8d1af3ea2a80e26d4e71860f1
|
4
|
+
data.tar.gz: 089d07e95a9ecf7f25681542681b08cde9a7ab05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fefbdcae19974cd97502be2f1b8b8e33ae181e4aa87b8ffed623b8c05f485e86ae4840277e4598297d8a7d05f028c51d79b0f43a0134fd782b32cc3e4435272c
|
7
|
+
data.tar.gz: f57932c54fe4729bbab0f485b26f93385107dab567001413d46c572ebbe5d04739541bf7a6bbbe483d84a7e72e7fc3014677a4a3d24e03c79a863839342060f0
|
data/README.markdown
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# Inflections [![Build Status](https://secure.travis-ci.org/davidcelis/inflections.png)](http://travis-ci.org/davidcelis/inflections)
|
2
2
|
|
3
|
-
|
3
|
+
Inflections is a repository containing non-English singularization and pluralization rules for Rails, supporting the multilingual ActiveSupport::Inflector in Rails 4.
|
4
4
|
|
5
|
-
|
5
|
+
## Languages Currently Supported
|
6
6
|
|
7
|
-
|
7
|
+
* Spanish (es)
|
8
|
+
* French (fr)
|
9
|
+
* Kazakh (kk)
|
10
|
+
* Norwegian Bokmål (nb)
|
11
|
+
* Turkish (tr)
|
12
|
+
|
13
|
+
If you are fluent in a language not yet included in this gem, _please_ consider creating a list of inflections and submitting a pull request.
|
8
14
|
|
9
15
|
## Installation
|
10
16
|
|
@@ -44,23 +50,13 @@ end
|
|
44
50
|
|
45
51
|
# Rails < 4.0.0
|
46
52
|
|
47
|
-
If you're not using ActiveSupport 4, the [multilingual Inflector](http://
|
53
|
+
If you're not using ActiveSupport 4, the [multilingual Inflector](http://davidcel.is/posts/edge-rails-a-multilingual-inflector/) won't be supported. You should install inflections 3.2.x and you'll have to choose which locale you use by requiring a specific file:
|
48
54
|
|
49
55
|
```ruby
|
50
|
-
gem 'inflections', '~> 3.2', require: 'inflections/
|
56
|
+
gem 'inflections', '~> 3.2', require: 'inflections/es'
|
51
57
|
```
|
52
58
|
|
53
|
-
|
54
|
-
|
55
|
-
* English (en)
|
56
|
-
* British English (en-GB)
|
57
|
-
* Spanish (es)
|
58
|
-
* French (fr)
|
59
|
-
* Kazakh (kk)
|
60
|
-
* Norwegian Bokmål (nb)
|
61
|
-
* Turkish (tr)
|
62
|
-
|
63
|
-
If you are fluent in a language not yet included in this gem, _please_ consider creating a list of inflections and submitting a pull request.
|
59
|
+
Note that this will override the default set of English rules that come with Rails. You should do this only if you plan on your constants and code itself not being in English.
|
64
60
|
|
65
61
|
## Contributing
|
66
62
|
|
data/lib/inflections.rb
CHANGED
data/lib/inflections/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inflections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -69,16 +69,12 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- inflections.gemspec
|
71
71
|
- lib/inflections.rb
|
72
|
-
- lib/inflections/en-GB.rb
|
73
|
-
- lib/inflections/en.rb
|
74
72
|
- lib/inflections/es.rb
|
75
73
|
- lib/inflections/fr.rb
|
76
74
|
- lib/inflections/kk.rb
|
77
75
|
- lib/inflections/nb.rb
|
78
76
|
- lib/inflections/tr.rb
|
79
77
|
- lib/inflections/version.rb
|
80
|
-
- test/en-GB_test.rb
|
81
|
-
- test/en_test.rb
|
82
78
|
- test/es_test.rb
|
83
79
|
- test/fr_test.rb
|
84
80
|
- test/kk_test.rb
|
@@ -109,8 +105,6 @@ signing_key:
|
|
109
105
|
specification_version: 4
|
110
106
|
summary: Sane inflection rules for ActiveSupport.
|
111
107
|
test_files:
|
112
|
-
- test/en-GB_test.rb
|
113
|
-
- test/en_test.rb
|
114
108
|
- test/es_test.rb
|
115
109
|
- test/fr_test.rb
|
116
110
|
- test/kk_test.rb
|
data/lib/inflections/en-GB.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Inflections
|
2
|
-
ActiveSupport::Inflector.inflections(:'en-GB') do |inflect|
|
3
|
-
inflect.clear
|
4
|
-
|
5
|
-
inflect.plural(/$/, 's')
|
6
|
-
inflect.plural(/([sxz]|[cs]h)$/i, '\1es')
|
7
|
-
inflect.plural(/([^aeiouy]o)$/i, '\1es')
|
8
|
-
inflect.plural(/([^aeiouy])y$/i, '\1ies')
|
9
|
-
|
10
|
-
inflect.singular(/s$/i, '')
|
11
|
-
inflect.singular(/(ss)$/i, '\1')
|
12
|
-
inflect.singular(/([sxz]|[cs]h)es$/, '\1')
|
13
|
-
inflect.singular(/([^aeiouy]o)es$/, '\1')
|
14
|
-
inflect.singular(/([^aeiouy])ies$/i, '\1y')
|
15
|
-
|
16
|
-
inflect.irregular('child', 'children')
|
17
|
-
inflect.irregular('person', 'people')
|
18
|
-
inflect.irregular('self', 'selves')
|
19
|
-
|
20
|
-
inflect.uncountable(%w(series))
|
21
|
-
end
|
22
|
-
end
|
data/lib/inflections/en.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Inflections
|
2
|
-
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
3
|
-
inflect.clear
|
4
|
-
|
5
|
-
inflect.plural(/$/, 's')
|
6
|
-
inflect.plural(/([sxz]|[cs]h)$/i, '\1es')
|
7
|
-
inflect.plural(/([^aeiouy]o)$/i, '\1es')
|
8
|
-
inflect.plural(/([^aeiouy])y$/i, '\1ies')
|
9
|
-
|
10
|
-
inflect.singular(/s$/i, '')
|
11
|
-
inflect.singular(/(ss)$/i, '\1')
|
12
|
-
inflect.singular(/([sxz]|[cs]h)es$/, '\1')
|
13
|
-
inflect.singular(/([^aeiouy]o)es$/, '\1')
|
14
|
-
inflect.singular(/([^aeiouy])ies$/i, '\1y')
|
15
|
-
|
16
|
-
inflect.irregular('child', 'children')
|
17
|
-
inflect.irregular('person', 'people')
|
18
|
-
inflect.irregular('self', 'selves')
|
19
|
-
|
20
|
-
inflect.uncountable(%w(series))
|
21
|
-
end
|
22
|
-
end
|
data/test/en-GB_test.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inflections/en-GB'
|
3
|
-
|
4
|
-
class TestEnglishInflections < Minitest::Test
|
5
|
-
def test_regular_plurals
|
6
|
-
assert_equal 'dogs', 'dog'.pluralize(:'en-GB')
|
7
|
-
assert_equal 'dog', 'dogs'.singularize(:'en-GB')
|
8
|
-
|
9
|
-
assert_equal 'days', 'day'.pluralize(:'en-GB')
|
10
|
-
assert_equal 'day', 'days'.singularize(:'en-GB')
|
11
|
-
|
12
|
-
assert_equal 'tests', 'test'.pluralize(:'en-GB')
|
13
|
-
assert_equal 'test', 'tests'.singularize(:'en-GB')
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_sibilant_sounds
|
17
|
-
assert_equal 'addresses', 'address'.pluralize(:'en-GB')
|
18
|
-
assert_equal 'address', 'addresses'.singularize(:'en-GB')
|
19
|
-
|
20
|
-
assert_equal 'phases', 'phase'.pluralize(:'en-GB')
|
21
|
-
|
22
|
-
assert_equal 'buzzes', 'buzz'.pluralize(:'en-GB')
|
23
|
-
assert_equal 'buzz', 'buzzes'.singularize(:'en-GB')
|
24
|
-
|
25
|
-
assert_equal 'boxes', 'box'.pluralize(:'en-GB')
|
26
|
-
assert_equal 'box', 'boxes'.singularize(:'en-GB')
|
27
|
-
|
28
|
-
assert_equal 'benches', 'bench'.pluralize(:'en-GB')
|
29
|
-
assert_equal 'bench', 'benches'.singularize(:'en-GB')
|
30
|
-
|
31
|
-
assert_equal 'dishes', 'dish'.pluralize(:'en-GB')
|
32
|
-
assert_equal 'dish', 'dishes'.singularize(:'en-GB')
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_oes_rule
|
36
|
-
assert_equal 'heroes', 'hero'.pluralize(:'en-GB')
|
37
|
-
assert_equal 'hero', 'heroes'.singularize(:'en-GB')
|
38
|
-
|
39
|
-
assert_equal 'igloos', 'igloo'.pluralize(:'en-GB')
|
40
|
-
assert_equal 'igloo', 'igloos'.singularize(:'en-GB')
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_ies_rule
|
44
|
-
assert_equal 'berries', 'berry'.pluralize(:'en-GB')
|
45
|
-
assert_equal 'berry', 'berries'.singularize(:'en-GB')
|
46
|
-
|
47
|
-
assert_equal 'days', 'day'.pluralize(:'en-GB')
|
48
|
-
assert_equal 'day', 'days'.singularize(:'en-GB')
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_irregulars
|
52
|
-
assert_equal 'children', 'child'.pluralize(:'en-GB')
|
53
|
-
assert_equal 'child', 'children'.singularize(:'en-GB')
|
54
|
-
|
55
|
-
assert_equal 'people', 'person'.pluralize(:'en-GB')
|
56
|
-
assert_equal 'person', 'people'.singularize(:'en-GB')
|
57
|
-
|
58
|
-
assert_equal 'selves', 'self'.pluralize(:'en-GB')
|
59
|
-
assert_equal 'self', 'selves'.singularize(:'en-GB')
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_uncountables
|
63
|
-
assert_equal 'series', 'series'.pluralize(:'en-GB')
|
64
|
-
assert_equal 'series', 'series'.singularize(:'en-GB')
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_stupid_inflections_removed
|
68
|
-
assert_equal 'cows', 'cow'.pluralize(:'en-GB')
|
69
|
-
end
|
70
|
-
end
|
data/test/en_test.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inflections/en'
|
3
|
-
|
4
|
-
class TestEnglishInflections < Minitest::Test
|
5
|
-
def test_regular_plurals
|
6
|
-
assert_equal 'dogs', 'dog'.pluralize(:en)
|
7
|
-
assert_equal 'dog', 'dogs'.singularize(:en)
|
8
|
-
|
9
|
-
assert_equal 'days', 'day'.pluralize(:en)
|
10
|
-
assert_equal 'day', 'days'.singularize(:en)
|
11
|
-
|
12
|
-
assert_equal 'tests', 'test'.pluralize(:en)
|
13
|
-
assert_equal 'test', 'tests'.singularize(:en)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_sibilant_sounds
|
17
|
-
assert_equal 'addresses', 'address'.pluralize(:en)
|
18
|
-
assert_equal 'address', 'addresses'.singularize(:en)
|
19
|
-
|
20
|
-
assert_equal 'phases', 'phase'.pluralize(:en)
|
21
|
-
|
22
|
-
assert_equal 'buzzes', 'buzz'.pluralize(:en)
|
23
|
-
assert_equal 'buzz', 'buzzes'.singularize(:en)
|
24
|
-
|
25
|
-
assert_equal 'boxes', 'box'.pluralize(:en)
|
26
|
-
assert_equal 'box', 'boxes'.singularize(:en)
|
27
|
-
|
28
|
-
assert_equal 'benches', 'bench'.pluralize(:en)
|
29
|
-
assert_equal 'bench', 'benches'.singularize(:en)
|
30
|
-
|
31
|
-
assert_equal 'dishes', 'dish'.pluralize(:en)
|
32
|
-
assert_equal 'dish', 'dishes'.singularize(:en)
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_oes_rule
|
36
|
-
assert_equal 'heroes', 'hero'.pluralize(:en)
|
37
|
-
assert_equal 'hero', 'heroes'.singularize(:en)
|
38
|
-
|
39
|
-
assert_equal 'igloos', 'igloo'.pluralize(:en)
|
40
|
-
assert_equal 'igloo', 'igloos'.singularize(:en)
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_ies_rule
|
44
|
-
assert_equal 'berries', 'berry'.pluralize(:en)
|
45
|
-
assert_equal 'berry', 'berries'.singularize(:en)
|
46
|
-
|
47
|
-
assert_equal 'days', 'day'.pluralize(:en)
|
48
|
-
assert_equal 'day', 'days'.singularize(:en)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_irregulars
|
52
|
-
assert_equal 'children', 'child'.pluralize(:en)
|
53
|
-
assert_equal 'child', 'children'.singularize(:en)
|
54
|
-
|
55
|
-
assert_equal 'people', 'person'.pluralize(:en)
|
56
|
-
assert_equal 'person', 'people'.singularize(:en)
|
57
|
-
|
58
|
-
assert_equal 'selves', 'self'.pluralize(:en)
|
59
|
-
assert_equal 'self', 'selves'.singularize(:en)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_uncountables
|
63
|
-
assert_equal 'series', 'series'.pluralize(:en)
|
64
|
-
assert_equal 'series', 'series'.singularize(:en)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_stupid_inflections_removed
|
68
|
-
assert_equal 'cows', 'cow'.pluralize(:en)
|
69
|
-
end
|
70
|
-
end
|