zh 0.1.0 → 1.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
- SHA1:
3
- metadata.gz: cb077963bb334fe4a26cf10c65f46ab839eb6e98
4
- data.tar.gz: 4f156f970d2a6ba5bbd472123009253d725e34f6
2
+ SHA256:
3
+ metadata.gz: 126d1c93ef1f54d94de5886869858637817ebc9e3de6637198e37eef261d3a9b
4
+ data.tar.gz: c213c2db0f9a6de96937d8f3fce1dff9cc340231d28ebb504d3522412fa1874d
5
5
  SHA512:
6
- metadata.gz: b5cf8cfe6bc205ccf45b7b4d572d07daed82ef1d366e1027383e090c14fc7b9c064da0688aadb4119482b588bc59a7979c90178b05e4f74c7777c62933225b42
7
- data.tar.gz: a6c2185e813c66d8d06491047f02185e1c21a4ec1791a2b80beb3d0c693967f7bee9d94e4cab6b9893aaaad86fd814b8db40dc964c3db9f172aee5b10da86211
6
+ metadata.gz: 47b878c33cbbe3eb08a41f3dfb742a5f254b632ccfebc3a16e2e4582453c26277e090576e8f18b5cb9d0a62b883b0a2030e886593cc9570f4b9ae0a23409f146
7
+ data.tar.gz: 3980b7e34b6ed75f7dec55c41d06317f6242dff410e748c11f66ec8664bb76d2242788de3a00425dea057246092d13cc04e537a17ca8463629f05fd7e7cead45
data/.gitignore CHANGED
@@ -1,4 +1,12 @@
1
- pkg
2
- .DS_Store
3
- *.gem
4
- coverage
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -1,18 +1,30 @@
1
+ ---
1
2
  language: ruby
2
3
  cache: bundler
3
-
4
4
  rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.0
8
-
5
+ - 2.3
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
9
+ - 2.7
9
10
  before_install:
10
- - gem update --system
11
- - gem --version
11
+ - gem install bundler
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
16
+ script:
17
+ - bundle exec rspec
18
+ after_script:
19
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
12
20
 
13
- notifications:
14
- email:
15
- recipients:
16
- - garylai1990@gmail.com
17
- on_failure: change
18
- on_success: never
21
+ jobs:
22
+ include:
23
+ - stage: gem release
24
+ rvm: 2.3
25
+ deploy:
26
+ provider: rubygems
27
+ gem: zh
28
+ api_key: $RUBYGEMS_API_KEY
29
+ on:
30
+ tags: true
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at garylai1990@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,21 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  gem 'rake'
6
- gem 'thor'
7
- gem 'json'
8
-
9
- group :development do
10
- gem 'guard'
11
- gem 'guard-rspec'
12
- gem 'pry'
13
- gem 'pry-remote'
14
- gem 'pry-nav'
15
- end
8
+ gem 'yajl-ruby', require: 'yajl'
16
9
 
17
10
  group :test do
18
11
  gem 'rspec'
19
- gem 'rspec-nc'
20
- gem 'coveralls'
12
+ gem 'simplecov', '~> 0.17.0', require: false
21
13
  end
@@ -1,101 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zh (0.1.0)
4
+ zh (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- celluloid (0.16.0)
10
- timers (~> 4.0.0)
11
- coderay (1.1.0)
12
- coveralls (0.7.2)
13
- multi_json (~> 1.3)
14
- rest-client (= 1.6.7)
15
- simplecov (>= 0.7)
16
- term-ansicolor (= 1.2.2)
17
- thor (= 0.18.1)
18
- diff-lcs (1.2.5)
19
- docile (1.1.5)
20
- ffi (1.9.6)
21
- formatador (0.2.5)
22
- guard (2.9.0)
23
- formatador (>= 0.2.4)
24
- listen (~> 2.7)
25
- lumberjack (~> 1.0)
26
- pry (>= 0.9.12)
27
- thor (>= 0.18.1)
28
- guard-rspec (4.3.1)
29
- guard (~> 2.1)
30
- rspec (>= 2.14, < 4.0)
31
- hitimes (1.2.2)
32
- json (1.8.1)
33
- listen (2.8.3)
34
- celluloid (>= 0.15.2)
35
- rb-fsevent (>= 0.9.3)
36
- rb-inotify (>= 0.9)
37
- lumberjack (1.0.9)
38
- method_source (0.8.2)
39
- mime-types (2.4.3)
40
- multi_json (1.10.1)
41
- pry (0.10.1)
42
- coderay (~> 1.1.0)
43
- method_source (~> 0.8.1)
44
- slop (~> 3.4)
45
- pry-nav (0.2.4)
46
- pry (>= 0.9.10, < 0.11.0)
47
- pry-remote (0.1.8)
48
- pry (~> 0.9)
49
- slop (~> 3.0)
50
- rake (10.4.0)
51
- rb-fsevent (0.9.4)
52
- rb-inotify (0.9.5)
53
- ffi (>= 0.5.0)
54
- rest-client (1.6.7)
55
- mime-types (>= 1.16)
56
- rspec (3.1.0)
57
- rspec-core (~> 3.1.0)
58
- rspec-expectations (~> 3.1.0)
59
- rspec-mocks (~> 3.1.0)
60
- rspec-core (3.1.7)
61
- rspec-support (~> 3.1.0)
62
- rspec-expectations (3.1.2)
9
+ diff-lcs (1.3)
10
+ docile (1.3.2)
11
+ json (2.3.0)
12
+ rake (13.0.1)
13
+ rspec (3.9.0)
14
+ rspec-core (~> 3.9.0)
15
+ rspec-expectations (~> 3.9.0)
16
+ rspec-mocks (~> 3.9.0)
17
+ rspec-core (3.9.2)
18
+ rspec-support (~> 3.9.3)
19
+ rspec-expectations (3.9.2)
63
20
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.1.0)
65
- rspec-mocks (3.1.3)
66
- rspec-support (~> 3.1.0)
67
- rspec-nc (0.2.0)
68
- rspec (>= 2.9)
69
- terminal-notifier (>= 1.4)
70
- rspec-support (3.1.2)
71
- simplecov (0.9.1)
72
- docile (~> 1.1.0)
73
- multi_json (~> 1.0)
74
- simplecov-html (~> 0.8.0)
75
- simplecov-html (0.8.0)
76
- slop (3.6.0)
77
- term-ansicolor (1.2.2)
78
- tins (~> 0.8)
79
- terminal-notifier (1.6.2)
80
- thor (0.18.1)
81
- timers (4.0.1)
82
- hitimes
83
- tins (0.13.2)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-mocks (3.9.1)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-support (3.9.3)
26
+ simplecov (0.17.1)
27
+ docile (~> 1.1)
28
+ json (>= 1.8, < 3)
29
+ simplecov-html (~> 0.10.0)
30
+ simplecov-html (0.10.2)
31
+ yajl-ruby (1.4.1)
84
32
 
85
33
  PLATFORMS
86
34
  ruby
87
35
 
88
36
  DEPENDENCIES
89
- bundler (~> 1.6)
90
- coveralls
91
- guard
92
- guard-rspec
93
- json
94
- pry
95
- pry-nav
96
- pry-remote
97
37
  rake
98
38
  rspec
99
- rspec-nc
100
- thor
39
+ simplecov (~> 0.17.0)
40
+ yajl-ruby
101
41
  zh!
42
+
43
+ BUNDLED WITH
44
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 zh-locale
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.
@@ -0,0 +1,70 @@
1
+ # Zh
2
+
3
+ [![Build Status](https://travis-ci.com/zh-locale/zh.rb.svg?branch=master)](https://travis-ci.com/zh-locale/zh.rb)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/e41546e0a90d9b9aaa20/maintainability)](https://codeclimate.com/github/zh-locale/zh.rb/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/e41546e0a90d9b9aaa20/test_coverage)](https://codeclimate.com/github/zh-locale/zh.rb/test_coverage)
6
+
7
+ Project that can convert Mandarin between any combination of regional dialect (type: traditional and simplified;
8
+ region: China, Hong Kong, Singapore and Taiwan).
9
+
10
+ ## Description
11
+
12
+ 台灣、港澳、新加坡、中國,是目前世界上使用中文比重較高的國家,或是說是母語,但雖然同為中文,但在使用上除了繁簡的差異外,還有地方詞彙的不同,在中文的翻譯轉換之間,不只是繁簡的轉換,有些甚至是整個詞彙的轉換
13
+
14
+ 以下舉幾個例子:
15
+
16
+ 同為繁體的,以 tw, hk 為例
17
+
18
+ tw|hk
19
+ ---|---
20
+ 數位單眼相機|數碼單鏡反光機
21
+
22
+ 同為簡體,以 sg, cn 為例
23
+
24
+ sg|cn
25
+ ---|---
26
+ 纽西兰|新西兰
27
+
28
+ 繁簡轉換,以 tw, cn 為例
29
+
30
+ tw|cn
31
+ ---|---
32
+ 複製人|克隆人
33
+
34
+ 資料來源:可參考此[專案的說明](https://github.com/siuying/zhconv#%E8%AA%AA%E6%98%8E)
35
+
36
+ 這個 Gem 則是透過以上的轉換表,來幫助轉換各地方中文的歧異
37
+
38
+ ## Special thanks
39
+
40
+ 這個 Gem 的概念源自於 [siuying/zhconv](https://github.com/siuying/zhconv),不過[作者 siuying ](https://github.com/siuying)最後的一筆 commit 已是兩年多前,部分資料已經有所變動,本來是想要 fork 來再做一些修正,但最後我想做的事情有些不同,決定獨立出來製作成一個 gem ,不送 pull request 給原作者,但還是感謝原作者的貢獻。
41
+
42
+ ## Installation
43
+
44
+ Add this line to your application's Gemfile:
45
+ ```
46
+ gem 'zh'
47
+ ```
48
+ And then execute:
49
+ ```
50
+ $ bundle
51
+ ```
52
+ Or install it yourself as:
53
+ ```
54
+ $ gem install zh
55
+ ```
56
+ ## Usage
57
+ ```
58
+ require 'zh'
59
+ puts Zh.to_tw("面包")
60
+ #=> "麵包"
61
+ ```
62
+
63
+ ## Contributing
64
+
65
+ 1. Fork it ( https://github.com/zh-locale/zh/fork )
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create a new Pull Request
70
+
data/README.md CHANGED
@@ -1,66 +1,83 @@
1
- [![Build Status](https://travis-ci.org/zxlai/zh.svg?branch=master)](https://travis-ci.org/zxlai/zh)
2
- [![Coverage Status](https://coveralls.io/repos/zxlai/zh/badge.png?branch=master)](https://coveralls.io/r/zxlai/zh?branch=master)
3
-
4
1
  # Zh
5
2
 
6
- Localization support for Mandarin.
3
+ [![Build Status](https://travis-ci.com/zh-locale/zh.rb.svg?branch=master)](https://travis-ci.com/zh-locale/zh.rb)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/e41546e0a90d9b9aaa20/maintainability)](https://codeclimate.com/github/zh-locale/zh.rb/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/e41546e0a90d9b9aaa20/test_coverage)](https://codeclimate.com/github/zh-locale/zh.rb/test_coverage)
7
6
 
8
7
  ## Description
9
8
 
10
- 台灣、港澳、新加坡、中國,是目前世界上使用中文比重較高的國家,或是說是母語,但雖然同為中文,但在使用上除了繁簡的差異外,還有地方詞彙的不同,在中文的翻譯轉換之間,不只是繁簡的轉換,有些甚至是整個詞彙的轉換
9
+ This project aims to help people use proper Mandarin in different locale settings.
10
+
11
+ In the English world, you may already know even British and American people are speaking English, these two versions of English are not the same. And even in the United States, there are words used differently from different areas. This is not only happening in English, Japanese, for example, is sometimes spoken differently in the Kanto and Kansai region (or more).
12
+
13
+ In the Mandarin world, two versions of Mandarin are known: Simplified and Traditional Chinese. However, there are more than just these two versions. Language is used differently in different regions, areas, and countries. More examples are provided below.
14
+
15
+ You can use this library to get the proper Mandarin usage between any combination of regional dialects. (Version: Simplified and Traditional Chinese;
16
+ Region: China, Hong Kong, Singapore, and Taiwan).
17
+
18
+ ### Examples
11
19
 
12
- 以下舉幾個例子:
20
+ Hong Kong vs Taiwan (both use Traditional Chinese)
13
21
 
14
- 同為繁體的,以 tw, hk 為例
22
+ English: Digital single-lens reflex camera
15
23
 
16
24
  tw|hk
17
25
  ---|---
18
26
  數位單眼相機|數碼單鏡反光機
19
27
 
20
- 同為簡體,以 sg, cn 為例
28
+ China vs Singapore (both use Simplified Chinese)
21
29
 
22
- sg|cn
23
- ---|---
24
- 纽西兰|新西兰
25
-
26
- 繁簡轉換,以 tw, cn 為例
30
+ English: New Zealand
27
31
 
28
- tw|cn
32
+ cn|sg
29
33
  ---|---
30
- 複製人|克隆人
34
+ 新西兰|纽西兰
31
35
 
32
- 資料來源:可參考此[專案的說明](https://github.com/siuying/zhconv#%E8%AA%AA%E6%98%8E)
36
+ China vs Taiwan. The difference is not only between in Simplified Chinese and Traditional Chinese, but also the character usage.
33
37
 
34
- 這個 Gem 則是透過以上的轉換表,來幫助轉換各地方中文的歧異
38
+ The word is translated according to the pronunciation in China, but the meaning in Taiwan.
35
39
 
36
- ## Special thanks
40
+ English: Clone
37
41
 
38
- 這個 Gem 的概念源自於 [siuying/zhconv](https://github.com/siuying/zhconv),不過[作者 siuying ](https://github.com/siuying)最後的一筆 commit 已是兩年多前,部分資料已經有所變動,本來是想要 fork 來再做一些修正,但最後我想做的事情有些不同,決定獨立出來製作成一個 gem ,不送 pull request 給原作者,但還是感謝原作者的貢獻。
42
+ cn|tw
43
+ ---|---
44
+ 克隆人|複製人
39
45
 
40
46
  ## Installation
41
47
 
42
48
  Add this line to your application's Gemfile:
49
+
43
50
  ```
44
51
  gem 'zh'
45
52
  ```
53
+
46
54
  And then execute:
55
+
47
56
  ```
48
57
  $ bundle
49
58
  ```
59
+
50
60
  Or install it yourself as:
61
+
51
62
  ```
52
63
  $ gem install zh
53
64
  ```
65
+
54
66
  ## Usage
55
- ```
67
+
68
+ ```ruby
56
69
  require 'zh'
57
70
  puts Zh.to_tw("面包")
58
71
  #=> "麵包"
59
72
  ```
60
73
 
74
+ ## Special thanks & Source:
75
+
76
+ I borrow many ideas from this project: [siuying/zhconv](https://github.com/siuying/zhconv).
77
+
61
78
  ## Contributing
62
79
 
63
- 1. Fork it ( https://github.com/zxlai/zh/fork )
80
+ 1. Fork it ( https://github.com/zh-locale/zh/fork )
64
81
  2. Create your feature branch (`git checkout -b my-new-feature`)
65
82
  3. Commit your changes (`git commit -am 'Add some feature'`)
66
83
  4. Push to the branch (`git push origin my-new-feature`)