inflections 4.0.0.beta1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2acbe516c4c7093e03e0a6107d6ae84d2e08a10
4
- data.tar.gz: a2a35cb0666b7c59731b860be9dbf8d8454ef188
3
+ metadata.gz: 3ac993d430f556418fbee44d79c1f5b11fc31653
4
+ data.tar.gz: d6b997e6d402a2beaf57cecc36ed9c3392b181a8
5
5
  SHA512:
6
- metadata.gz: bfa96dfbda73265a7290fdd1db2404cb43e65f0e9a4ed52708314485a5d6585a65e4226d11f14bcd94f0f0e88e1588da01351e6b96d11ec346623e01ba13234d
7
- data.tar.gz: a9cf7136d9bc73ceef4afdef06ae72b7c80cb78b9b39e155d2b82da121bf8a7eb9a2f040ab056da8ad24d10380396ec01deed6699a495da56c77af2061580afc
6
+ metadata.gz: b850277bbcbeadb2c51022f4587131d4808ce100d8ea2d6fd35889d71e9addeda4ffdf45d6a01c6bf68be2c25f86b2c9e38e13d99824cf738811187cfb0cb935
7
+ data.tar.gz: 1c1422da8bffccab323b8ae27f8a75f03ef74f42df3d41b260ad9c1a59b1e4382f1d1d27e345bb98b069c658016e53e895cbad054b2f8c991642bbfe022dde02
@@ -1,5 +1,17 @@
1
- 3.2.9.20121206 (current version)
2
- ================================
1
+ 3.2.12.20130314 (Current release)
2
+ =================================
3
+ * Support for French (thanks to [Olivier Laviale](https://github.com/olvlvl) of [ICanBoogie](https://github.com/ICanBoogie/Inflector))
4
+
5
+ 3.2.12.20130305
6
+ ===============
7
+ * Fix #9 - a bug that was causing all strings to pluralize and singularize in Turkish.
8
+
9
+ 3.2.12
10
+ ======
11
+ * Support for Turkish (thanks to [Ferhat Elmas](https://github.com/ferhatelmas))
12
+
13
+ 3.2.9.20121206
14
+ ==============
3
15
  * Support for Kazakh (thanks to [Galymzhan Kozhayev](https://github.com/galymzhan))
4
16
 
5
17
  3.2.9
@@ -24,36 +24,46 @@ $ bundle
24
24
 
25
25
  ### Ruby on Rails
26
26
 
27
- If you're using Rails, you're done. The default inflections defined in ActiveSupport will be overwritten, and you can continue to define your own special cases in `config/intializers/inflections.rb`. I18n's default locale (set in `config/application.rb`) will determine which inflections are loaded.
27
+ You're done. The default inflections defined in ActiveSupport will be overwritten, and you can continue to define your own special cases in `config/intializers/inflections.rb`. I18n's default locale (set in `config/application.rb`) will determine which inflections are loaded.
28
28
 
29
29
  ### Otherwise
30
30
 
31
31
  Wherever you need 'em:
32
32
 
33
33
  ```ruby
34
- require 'inflections/en' # Replace 'en' with your preferred locale.
34
+ require 'inflections'
35
+
36
+ # Or require specific locales
37
+ # require 'inflections/en'
38
+ # require 'inflections/es'
35
39
  ```
36
40
 
37
41
  Define your own additional rules as such:
38
42
 
39
43
  ```ruby
40
- ActiveSupport::Inflector.inflections do |inflect|
41
- inflect.singular /(phase)s$/i, '\1'
44
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
45
+ inflect.singular /(phase)s$/i, '\1'
42
46
  inflect.plural /(shel|kni)fe/, '\1ves'
43
47
  inflect.irregular 'foot', 'feet'
44
- inflect.uncountable %w( money )
48
+ inflect.uncountable %w[money fish]
45
49
  end
46
50
  ```
47
51
 
48
- ### Edge
52
+ # Rails < 4.0.0
53
+
54
+ If you're not using ActiveSupport 4.0, the multilingual Inflector won't be supported. You'll have to choose which locale you use. [Read more about the multilingual Inflector](http://davidcelis.com/blog/2012/07/31/edge-rails-a-multilingual-inflector/).
49
55
 
50
- If you're using the edge version of ActiveSupport (4.0.0.beta), the multilingual Inflector will be supported. You can use each set of inflection rules without needing to require them or worry about conflicts between languages. Just point your Gemfile to this git repository; each locale's set of inflection rules will be kept separately and you can use any of them side-by-side. [Read more about the multilingual Inflector](http://davidcelis.com/blog/2012/07/31/edge-rails-a-multilingual-inflector/).
56
+ ```ruby
57
+ # Require the old version and choose your locale
58
+ gem 'inflections', '~> 3.2', require: 'inflections/en'
59
+ ```
51
60
 
52
61
  ## Languages Currently Supported
53
62
 
54
63
  * English (en)
55
64
  * British English (en-GB)
56
65
  * Spanish (es)
66
+ * French (fr)
57
67
  * Kazakh (kk)
58
68
  * Norwegian Bokmål (nb)
59
69
  * Turkish (tr)
@@ -1,6 +1,7 @@
1
1
  require 'inflections/en'
2
2
  require 'inflections/en-GB'
3
3
  require 'inflections/es'
4
+ require 'inflections/fr'
4
5
  require 'inflections/kk'
5
6
  require 'inflections/nb'
6
- require 'inflections/tr'
7
+ require 'inflections/tr'
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ #
3
+ # These rules come from a port of ActiveSupport's Inflector to PHP:
4
+ # https://github.com/ICanBoogie/Inflector/blob/master/lib/inflections/fr.php
5
+
6
+ module Inflections
7
+ ActiveSupport::Inflector.inflections(:fr) do |inflect|
8
+ inflect.clear
9
+
10
+ inflect.plural(/$/, 's')
11
+ inflect.singular(/s$/, '')
12
+
13
+ inflect.plural(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/, '\1x')
14
+ inflect.singular(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/, '\1')
15
+
16
+ inflect.plural(/(bleu|émeu|landau|lieu|pneu|sarrau)$/, '\1s')
17
+ inflect.plural(/al$/, 'aux')
18
+ inflect.plural(/ail$/, 'ails')
19
+ inflect.singular(/(journ|chev)aux$/, '\1al')
20
+ inflect.singular(/ails$/, 'ail')
21
+
22
+ inflect.plural(/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/, '\1aux')
23
+ inflect.singular(/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/, '\1ail')
24
+
25
+ inflect.plural(/(s|x|z)$/, '\1')
26
+
27
+ inflect.irregular('monsieur', 'messieurs')
28
+ inflect.irregular('madame', 'mesdames')
29
+ inflect.irregular('mademoiselle', 'mesdemoiselles')
30
+ end
31
+ end
@@ -2,7 +2,7 @@ module Inflections
2
2
  MAJOR = 4
3
3
  MINOR = 0
4
4
  PATCH = 0
5
- PRE = 'beta1'
5
+ PRE = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
8
8
  end
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test_helper'
4
+ require 'inflections/fr'
5
+
6
+ class TestFrenchInflections < MiniTest::Unit::TestCase
7
+ def test_regular_plurals
8
+ assert_equal 'amis', 'ami'.pluralize(:fr)
9
+ assert_equal 'ami', 'amis'.singularize(:fr)
10
+
11
+ assert_equal 'fidèles', 'fidèle'.pluralize(:fr)
12
+ assert_equal 'fidèle', 'fidèles'.singularize(:fr)
13
+
14
+ assert_equal 'rapports', 'rapport'.pluralize(:fr)
15
+ assert_equal 'rapport', 'rapports'.singularize(:fr)
16
+ end
17
+
18
+ def test_appending_x
19
+ # -au
20
+ assert_equal 'tuyaux', 'tuyau'.pluralize(:fr)
21
+ assert_equal 'tuyau', 'tuyaux'.singularize(:fr)
22
+
23
+ # -ou
24
+ assert_equal 'genoux', 'genou'.pluralize(:fr)
25
+ assert_equal 'genou', 'genoux'.singularize(:fr)
26
+
27
+ # -eu
28
+ assert_equal 'aveux', 'aveu'.pluralize(:fr)
29
+ assert_equal 'aveu', 'aveux'.singularize(:fr)
30
+
31
+ # -eau
32
+ assert_equal 'nouveaux', 'nouveau'.pluralize(:fr)
33
+ assert_equal 'nouveau', 'nouveaux'.singularize(:fr)
34
+ end
35
+
36
+ def test_exceptions_to_appending_x
37
+ assert_equal 'bleus', 'bleu'.pluralize(:fr)
38
+ assert_equal 'bleu', 'bleus'.singularize(:fr)
39
+
40
+ assert_equal 'landaus', 'landau'.pluralize(:fr)
41
+ assert_equal 'landau', 'landaus'.singularize(:fr)
42
+
43
+ assert_equal 'genoux', 'genou'.pluralize(:fr)
44
+ assert_equal 'genou', 'genoux'.singularize(:fr)
45
+ end
46
+
47
+ def test_ending_in_al
48
+ assert_equal 'journaux', 'journal'.pluralize(:fr)
49
+ assert_equal 'journal', 'journaux'.singularize(:fr)
50
+ end
51
+
52
+ def test_ending_in_ail
53
+ assert_equal 'détails', 'détail'.pluralize(:fr)
54
+ assert_equal 'détail', 'détails'.singularize(:fr)
55
+ end
56
+
57
+ def test_exceptions_to_ending_in_ail
58
+ assert_equal 'travaux', 'travail'.pluralize(:fr)
59
+ assert_equal 'travail', 'travaux'.singularize(:fr)
60
+
61
+ assert_equal 'baux', 'bail'.pluralize(:fr)
62
+ assert_equal 'bail', 'baux'.singularize(:fr)
63
+
64
+ assert_equal 'émaux', 'émail'.pluralize(:fr)
65
+ assert_equal 'émail', 'émaux'.singularize(:fr)
66
+ end
67
+ end
@@ -1,3 +1,6 @@
1
+ $LOAD_PATH.unshift File.expand_path('../cases', __FILE__)
2
+
1
3
  require 'bundler/setup'
2
4
  require 'minitest/autorun'
5
+ require 'minitest/pride'
3
6
  require 'active_support/inflector'
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.0.beta1
4
+ version: 4.0.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: 2013-02-27 00:00:00.000000000 Z
11
+ date: 2013-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -72,6 +72,7 @@ files:
72
72
  - lib/inflections/en-GB.rb
73
73
  - lib/inflections/en.rb
74
74
  - lib/inflections/es.rb
75
+ - lib/inflections/fr.rb
75
76
  - lib/inflections/kk.rb
76
77
  - lib/inflections/nb.rb
77
78
  - lib/inflections/tr.rb
@@ -79,6 +80,7 @@ files:
79
80
  - test/en-GB_test.rb
80
81
  - test/en_test.rb
81
82
  - test/es_test.rb
83
+ - test/fr_test.rb
82
84
  - test/kk_test.rb
83
85
  - test/nb_test.rb
84
86
  - test/test_helper.rb
@@ -97,12 +99,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
99
  version: '0'
98
100
  required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  requirements:
100
- - - '>'
102
+ - - '>='
101
103
  - !ruby/object:Gem::Version
102
- version: 1.3.1
104
+ version: '0'
103
105
  requirements: []
104
106
  rubyforge_project:
105
- rubygems_version: 2.0.0
107
+ rubygems_version: 2.0.3
106
108
  signing_key:
107
109
  specification_version: 4
108
110
  summary: Sane inflection rules for ActiveSupport.
@@ -110,6 +112,8 @@ test_files:
110
112
  - test/en-GB_test.rb
111
113
  - test/en_test.rb
112
114
  - test/es_test.rb
115
+ - test/fr_test.rb
113
116
  - test/kk_test.rb
114
117
  - test/nb_test.rb
115
118
  - test/tr_test.rb
119
+ has_rdoc: