mandarin_chinese_inflections 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +6 -0
- data/lib/mandarin_chinese_inflections.rb +12 -0
- data/lib/mandarin_chinese_inflections/version.rb +3 -0
- data/mandarin_chinese_inflections.gemspec +28 -0
- metadata +112 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 95a34c97b804c77bcbb486533d0e83829186fa86ab89b5b7f71094b5516a6b2b
|
|
4
|
+
data.tar.gz: d1898e60802454668589aafc5d86690e83432578f8bce2a24de23d145bb753c5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e08a98514b31cd86d7a458795c6253c329f315caf7c13e554ed60277568d939aa66644ee42d6b05b897dcc86c568ff4083a5992cadaad3af7bb5a703e687c34e
|
|
7
|
+
data.tar.gz: b5cbdda59375962f50b33e4bd84c1d0754982998c4dfaa8fd5e3f922c9a8b663d9da0c22dc0f092c8a827ca4c13f7daac84943e43bf5c893397089042c5daa5c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
mandarin_chinese_inflections (1.0.0)
|
|
5
|
+
activesupport (>= 4.0.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activesupport (5.1.5)
|
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
12
|
+
i18n (~> 0.7)
|
|
13
|
+
minitest (~> 5.1)
|
|
14
|
+
tzinfo (~> 1.1)
|
|
15
|
+
concurrent-ruby (1.0.5)
|
|
16
|
+
diff-lcs (1.3)
|
|
17
|
+
i18n (0.9.5)
|
|
18
|
+
concurrent-ruby (~> 1.0)
|
|
19
|
+
minitest (5.11.3)
|
|
20
|
+
rake (10.5.0)
|
|
21
|
+
rspec (3.7.0)
|
|
22
|
+
rspec-core (~> 3.7.0)
|
|
23
|
+
rspec-expectations (~> 3.7.0)
|
|
24
|
+
rspec-mocks (~> 3.7.0)
|
|
25
|
+
rspec-core (3.7.1)
|
|
26
|
+
rspec-support (~> 3.7.0)
|
|
27
|
+
rspec-expectations (3.7.0)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.7.0)
|
|
30
|
+
rspec-mocks (3.7.0)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.7.0)
|
|
33
|
+
rspec-support (3.7.1)
|
|
34
|
+
thread_safe (0.3.6)
|
|
35
|
+
tzinfo (1.2.5)
|
|
36
|
+
thread_safe (~> 0.1)
|
|
37
|
+
|
|
38
|
+
PLATFORMS
|
|
39
|
+
ruby
|
|
40
|
+
|
|
41
|
+
DEPENDENCIES
|
|
42
|
+
bundler (~> 1.16)
|
|
43
|
+
mandarin_chinese_inflections!
|
|
44
|
+
rake (~> 10.0)
|
|
45
|
+
rspec (~> 3.0)
|
|
46
|
+
|
|
47
|
+
BUNDLED WITH
|
|
48
|
+
1.16.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Donna Zhou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
🐼 Mandarin Chinese Inflections
|
|
2
|
+
=====
|
|
3
|
+
|
|
4
|
+
This repository contains the **complete and definitive** set of Mandarin Chinese singularization and pluralization rules for Rails.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
Add the following to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'mandarin_chinese_inflections'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
To inflect strings in different locales:
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
'dumpling'.pluralize(:en) # => "dumplings"
|
|
24
|
+
'饺子'.pluralize(:zh) # => "饺子"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Is this *really* the complete set of inflection rules?
|
|
28
|
+
Yes, this is the **complete and definitive** set of inflection rules for Mandarin Chinese.
|
|
29
|
+
|
|
30
|
+
I am very upset that the [English inflection file](https://github.com/rails/rails/blob/5-2-stable/activesupport/lib/active_support/inflections.rb#L7) is *still* incomplete after all these years. They simply aren't trying hard enough!
|
|
31
|
+
|
|
32
|
+
If you are new to Mandarin Chinese, I have provided a short comparison of inflections in English and Mandarin Chinese below.
|
|
33
|
+
|
|
34
|
+
### Inflection in English and Mandarin Chinese
|
|
35
|
+
|
|
36
|
+
**English**
|
|
37
|
+
|
|
38
|
+
| | 🥢 | 🍜 | 🥟 |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| Singular | chopstick | bowl | dumpling |
|
|
41
|
+
| Plural | chopsticks | bowls | dumplings |
|
|
42
|
+
|
|
43
|
+
**Mandarin Chinese**
|
|
44
|
+
|
|
45
|
+
| | 🥢 | 🍜 | 🥟 |
|
|
46
|
+
| --- | --- | --- | --- |
|
|
47
|
+
| Singular | 筷子 | 碗 | 饺子 |
|
|
48
|
+
| Plural | 筷子 | 碗 | 饺子 |
|
|
49
|
+
|
|
50
|
+
## Rails < 4.0.0
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
## Contributing
|
|
54
|
+
This is the **complete and definitive** inflection gem for Mandarin Chinese. No further contributions are required, thank you. 😛
|
|
55
|
+
|
|
56
|
+
Made by [@dondonz](https://github.com/dondonz). See more at [failscasts.com](www.failscasts.com).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "mandarin_chinese_inflections/version"
|
|
2
|
+
require "active_support/inflector"
|
|
3
|
+
|
|
4
|
+
module MandarinChineseInflections
|
|
5
|
+
ActiveSupport::Inflector.inflections(:zh) do |inflect|
|
|
6
|
+
inflect.clear
|
|
7
|
+
|
|
8
|
+
inflect.plural(/$/, "")
|
|
9
|
+
|
|
10
|
+
inflect.singular(/$/, "")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "mandarin_chinese_inflections/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "mandarin_chinese_inflections"
|
|
8
|
+
spec.version = MandarinChineseInflections::VERSION
|
|
9
|
+
spec.authors = ["Donna Zhou"]
|
|
10
|
+
spec.email = ["hello@failscasts.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{🐼 Mandarin Chinese singularization and pluralization rules for ActiveSupport and Rails.}
|
|
13
|
+
spec.homepage = "http://www.failscasts.com"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
|
18
|
+
end
|
|
19
|
+
spec.bindir = "exe"
|
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
26
|
+
|
|
27
|
+
spec.add_dependency "activesupport", ">= 4.0.0"
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mandarin_chinese_inflections
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Donna Zhou
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.16'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.16'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: activesupport
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 4.0.0
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 4.0.0
|
|
69
|
+
description:
|
|
70
|
+
email:
|
|
71
|
+
- hello@failscasts.com
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- ".rspec"
|
|
78
|
+
- ".travis.yml"
|
|
79
|
+
- Gemfile
|
|
80
|
+
- Gemfile.lock
|
|
81
|
+
- LICENSE.txt
|
|
82
|
+
- README.md
|
|
83
|
+
- Rakefile
|
|
84
|
+
- lib/mandarin_chinese_inflections.rb
|
|
85
|
+
- lib/mandarin_chinese_inflections/version.rb
|
|
86
|
+
- mandarin_chinese_inflections.gemspec
|
|
87
|
+
homepage: http://www.failscasts.com
|
|
88
|
+
licenses:
|
|
89
|
+
- MIT
|
|
90
|
+
metadata: {}
|
|
91
|
+
post_install_message:
|
|
92
|
+
rdoc_options: []
|
|
93
|
+
require_paths:
|
|
94
|
+
- lib
|
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
requirements: []
|
|
106
|
+
rubyforge_project:
|
|
107
|
+
rubygems_version: 2.7.5
|
|
108
|
+
signing_key:
|
|
109
|
+
specification_version: 4
|
|
110
|
+
summary: "\U0001F43C Mandarin Chinese singularization and pluralization rules for
|
|
111
|
+
ActiveSupport and Rails."
|
|
112
|
+
test_files: []
|