isodoc-i18n 1.1.3 → 1.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 573397fe43411b36723793fd50893ce1fd5eda84ca84f8e00ba608f6e50f3cd5
4
- data.tar.gz: 3117720a218de8fe171ee8c4d3237c97408a87beac521d4bb13d0d1021d329a9
3
+ metadata.gz: 2995acc039a84f2046a7dd94885f6645db44c003e13e3c2d03acc080df6ccf46
4
+ data.tar.gz: 10aaebe352a542028a9e6bf1d69b3e6d1309416a0fc4329aa34053a520bdc982
5
5
  SHA512:
6
- metadata.gz: 865a347ccd8f837f4a88f950179d375a79db880ca61de6880d545163ad5e8ca19488410f7dc0a03cf8205a3d948256b58dae49909a442427ffb409635ed7d9c5
7
- data.tar.gz: a0a3ba98de7b47388e81f9bbdc8dac86e95f9c91aaca0290b1952d9bf7b9f98d23b5725bc70c75f8018c65d61bbaaa629fe65ee2edb868f6cb1dab1223afa8a3
6
+ metadata.gz: f9aa2d2786ef223580b0cd832dd08d9821e06553975a369abda5e03b947cff9c5d44ad20ace189937e3707c536ffa99b5090b8cdc8ccf6cbf1dfc429ed0df623
7
+ data.tar.gz: bd0b5bc0c703ae8ffeeeea6d8df3df34d004bc478b4e8e0ec61c450da83b7c1571954e538bd43a3e7af320035496baa96a27e3d6f564dc7ea5afa58c3244638a
data/isodoc-i18n.gemspec CHANGED
@@ -1,6 +1,4 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "isodoc/version"
1
+ require_relative "lib/isodoc/i18n/version"
4
2
 
5
3
  Gem::Specification.new do |spec|
6
4
  spec.name = "isodoc-i18n"
@@ -18,9 +16,11 @@ Gem::Specification.new do |spec|
18
16
 
19
17
  spec.bindir = "bin"
20
18
  spec.require_paths = ["lib"]
21
- spec.files = `git ls-files`.split("\n")
22
- spec.test_files = `git ls-files -- {spec}/*`.split("\n")
23
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features|bin|.github)/}) \
21
+ || f.match(%r{Rakefile|bin/rspec})
22
+ end
23
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
24
24
 
25
25
  spec.add_dependency "htmlentities", "~> 4.3.4"
26
26
  spec.add_dependency "metanorma-utils", "~> 1.4.0"
@@ -36,5 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "simplecov", "~> 0.15"
37
37
  spec.add_development_dependency "timecop", "~> 0.9"
38
38
  spec.add_development_dependency "webmock"
39
- #spec.metadata["rubygems_mfa_required"] = "true"
39
+ # spec.metadata["rubygems_mfa_required"] = "true"
40
40
  end
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
2
  class I18n
3
- VERSION = "1.1.3".freeze
3
+ VERSION = "1.1.4".freeze
4
4
  end
5
5
  end
data/lib/isodoc/i18n.rb CHANGED
@@ -2,6 +2,7 @@ require "yaml"
2
2
  require "htmlentities"
3
3
  require "metanorma-utils"
4
4
  require "twitter_cldr"
5
+ require_relative "i18n/version"
5
6
 
6
7
  module IsoDoc
7
8
  class I18n
data/lib/isodoc-i18n.rb CHANGED
@@ -1,5 +1 @@
1
- require_relative "isodoc/version"
2
1
  require_relative "isodoc/i18n"
3
-
4
- module IsoDoc
5
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -201,26 +201,17 @@ executables: []
201
201
  extensions: []
202
202
  extra_rdoc_files: []
203
203
  files:
204
- - ".github/workflows/rake.yml"
205
- - ".github/workflows/release.yml"
206
204
  - ".hound.yml"
207
205
  - ".rubocop.yml"
208
206
  - CODE_OF_CONDUCT.md
209
207
  - Gemfile
210
208
  - LICENSE
211
209
  - README.adoc
212
- - Rakefile
213
- - bin/rspec
214
210
  - isodoc-i18n.gemspec
215
211
  - lib/isodoc-i18n.rb
216
212
  - lib/isodoc-yaml/i18n-en.yaml
217
213
  - lib/isodoc/i18n.rb
218
- - lib/isodoc/version.rb
219
- - spec/assets/de.yaml
220
- - spec/assets/new.yaml
221
- - spec/assets/zh-Hans.yaml
222
- - spec/isodoc/base_spec.rb
223
- - spec/spec_helper.rb
214
+ - lib/isodoc/i18n/version.rb
224
215
  homepage: https://github.com/metanorma/isodoc-i18n
225
216
  licenses:
226
217
  - BSD-2-Clause
@@ -233,14 +224,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
224
  requirements:
234
225
  - - ">="
235
226
  - !ruby/object:Gem::Version
236
- version: 2.5.0
227
+ version: 2.7.0
237
228
  required_rubygems_version: !ruby/object:Gem::Requirement
238
229
  requirements:
239
230
  - - ">="
240
231
  - !ruby/object:Gem::Version
241
232
  version: '0'
242
233
  requirements: []
243
- rubygems_version: 3.1.6
234
+ rubygems_version: 3.3.7
244
235
  signing_key:
245
236
  specification_version: 4
246
237
  summary: isodoc-i18n
@@ -1,15 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: rake
4
-
5
- on:
6
- push:
7
- branches: [ master, main ]
8
- tags: [ v* ]
9
- pull_request:
10
-
11
- jobs:
12
- rake:
13
- uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
- secrets:
15
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
@@ -1,24 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: release
4
-
5
- on:
6
- workflow_dispatch:
7
- inputs:
8
- next_version:
9
- description: |
10
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
- required: true
12
- default: 'skip'
13
- push:
14
- tags: [ v* ]
15
-
16
- jobs:
17
- release:
18
- uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
19
- with:
20
- next_version: ${{ github.event.inputs.next_version }}
21
- secrets:
22
- rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
23
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
24
-
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
data/bin/rspec DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rspec' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require "pathname"
10
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
- "../../Gemfile", Pathname.new(__FILE__).realpath
12
- )
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("rspec-core", "rspec")
data/spec/assets/de.yaml DELETED
@@ -1,12 +0,0 @@
1
- ordinal_keys: [gender,number]
2
- SpelloutRules:
3
- m.sg: spellout-ordinal-r
4
- f.sg: spellout-ordinal
5
- n.sg: spellout-ordinal-s
6
- m.pl: spellout-ordinal
7
- f.pl: spellout-ordinal
8
- n.pl: spellout-ordinal
9
- edition: Auflage
10
- inflection:
11
- Auflage:
12
- gender: f
data/spec/assets/new.yaml DELETED
@@ -1,53 +0,0 @@
1
- hash:
2
- key1: val1
3
- key2: val2
4
- arr:
5
- - arr1
6
- - arr2
7
- text: "text2"
8
- inflection:
9
- Fred:
10
- sg: Fred
11
- pl: Freds
12
- Man:
13
- dat: viri
14
- acc: virem
15
- Woman:
16
- sg:
17
- nom: mulier
18
- gen: mulieris
19
- pl:
20
- nom: mulieres
21
- gen: mulierum
22
- Good:
23
- sg:
24
- nom:
25
- masc: bonus
26
- fem: bona
27
- neut: bonum
28
- gen:
29
- masc: boni
30
- fem: bonae
31
- neut: boni
32
- pl:
33
- nom:
34
- masc: boni
35
- fem: bonae
36
- neut: bona
37
- gen:
38
- masc: bonorum
39
- fem: bonarum
40
- neut: bonorum
41
- Walk:
42
- act:
43
- ind:
44
- pres:
45
- sg:
46
- 1st: ambulo
47
- 2nd: ambulas
48
- subj:
49
- pres:
50
- pl:
51
- 1st: ambulemus
52
- 2nd: ambuletis
53
-
@@ -1,7 +0,0 @@
1
- ordinal_keys: []
2
- SpelloutRules: spellout-ordinal
3
- edition: Auflage
4
- inflection:
5
- Auflage:
6
- gender: f
7
-
@@ -1,158 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc::I18n do
4
- it "has a version number" do
5
- expect(IsoDoc::I18n::VERSION).not_to be nil
6
- end
7
-
8
- it "loads language files" do
9
- c = IsoDoc::I18n.new("en", "Latn")
10
- expect(c.text).to eq "text"
11
- expect(c.at).to eq "at"
12
- expect(c.language).to eq "en"
13
- expect(c.script).to eq "Latn"
14
- end
15
-
16
- it "manipulates i18n class" do
17
- c = IsoDoc::I18n.new("en", "Latn")
18
- expect(c.get["text"]).to eq "text"
19
- expect(c.get["fred"]).to be_nil
20
- c.set("fred", "frederic")
21
- expect(c.get["fred"]).to eq "frederic"
22
- end
23
-
24
- it "loads default for missing language files" do
25
- c = IsoDoc::I18n.new("tlh", "Klin")
26
- expect(c.text).to eq "text"
27
- expect(c.at).to eq "at"
28
- expect(c.language).to eq "tlh"
29
- expect(c.script).to eq "Klin"
30
- end
31
-
32
- it "loads language file overrides" do
33
- c = IsoDoc::I18n.new("en", "Latn", i18nyaml: "spec/assets/new.yaml")
34
- expect(c.text).to eq "text2"
35
- expect(c.at).to eq "at"
36
- expect(c.hash.to_s).to be_equivalent_to '{"key1"=>"val1", "key2"=>"val2"}'
37
- expect(c.arr.to_s).to eq '["arr1", "arr2"]'
38
- end
39
-
40
- it "loads language hash overrides" do
41
- c = IsoDoc::I18n.new("en", "Latn",
42
- i18nhash: YAML.load_file("spec/assets/new.yaml"))
43
- expect(c.text).to eq "text2"
44
- expect(c.at).to eq "at"
45
- expect(c.hash.to_s).to be_equivalent_to '{"key1"=>"val1", "key2"=>"val2"}'
46
- expect(c.arr.to_s).to eq '["arr1", "arr2"]'
47
- end
48
-
49
- it "does English localisation" do
50
- c = IsoDoc::I18n.new("en", "Latn")
51
- expect(c.l10n("Code (hello, world.)"))
52
- .to be_equivalent_to "Code (hello, world.)"
53
- expect(c.l10n("<a>Code (he<b>l</b>lo, world.)</a>"))
54
- .to be_equivalent_to "<a>Code (he<b>l</b>lo, world.)</a>"
55
- end
56
-
57
- it "does Chinese localisation" do
58
- c = IsoDoc::I18n.new("zh", "Hans")
59
- expect(c.l10n("Code (hello, world.)"))
60
- .to be_equivalent_to "Code (hello, world.)"
61
- expect(c.l10n("计算机代码 (你好, 世界.)"))
62
- .to be_equivalent_to " 计算机代码(你好,世界。)"
63
- expect(c.l10n("<a>计算机代码</a> (<b>你好,</b> 世界.)"))
64
- .to be_equivalent_to "<a>计算机代码</a> (你好, 世界。)"
65
- end
66
-
67
- it "does Hebrew RTL localisation" do
68
- c = IsoDoc::I18n.new("en", "Hebr")
69
- expect(c.l10n("Code (hello, world.)"))
70
- .to be_equivalent_to "Code (hello, world.)"
71
- expect(c.l10n("Code (hello, world.)", "en", "Latn"))
72
- .to be_equivalent_to "&#x200e;Code (hello, world.)&#x200e;"
73
- c = IsoDoc::I18n.new("en", "Latn")
74
- expect(c.l10n("Code (hello, world.)", "en", "Hebr"))
75
- .to be_equivalent_to "&#x200f;Code (hello, world.)&#x200f;"
76
- end
77
-
78
- it "does Arabic RTL localisation" do
79
- c = IsoDoc::I18n.new("en", "Arab")
80
- expect(c.l10n("Code (hello, world.)"))
81
- .to be_equivalent_to "Code (hello, world.)"
82
- expect(c.l10n("Code (hello, world.)", "en", "Latn"))
83
- .to be_equivalent_to "&#x200e;Code (hello, world.)&#x200e;"
84
- c = IsoDoc::I18n.new("en", "Latn")
85
- expect(c.l10n("Code (hello, world.)", "en", "Arab"))
86
- .to be_equivalent_to "&#x61c;Code (hello, world.)&#x61c;"
87
- end
88
-
89
- it "does French localisation" do
90
- e = HTMLEntities.new
91
- c = IsoDoc::I18n.new("fr", "Latn")
92
- expect(e.encode(c.l10n("Code; «code» and: code!"), :hexadecimal))
93
- .to be_equivalent_to "Code&#x202f;; &#xab;&#x202f;code&#x202f;&#xbb; " \
94
- "and&#xa0;: code&#x202f;!"
95
- expect(e.encode(c.l10n("Code; &#xab;code&#xbb; and: code!"), :hexadecimal))
96
- .to be_equivalent_to "Code&#x202f;; &#xab;&#x202f;code&#x202f;&#xbb; " \
97
- "and&#xa0;: code&#x202f;!"
98
- c = IsoDoc::I18n.new("fr", "Latn", locale: "FR")
99
- expect(e.encode(c.l10n("Code; «code» and: code!"), :hexadecimal))
100
- .to be_equivalent_to "Code&#x202f;; &#xab;&#x202f;code&#x202f;&#xbb; " \
101
- "and&#xa0;: code&#x202f;!"
102
- c = IsoDoc::I18n.new("fr", "Latn", locale: "CH")
103
- expect(e.encode(c.l10n("Code; «code» and: code!"), :hexadecimal))
104
- .to be_equivalent_to "Code&#x202f;; &#xab;&#x202f;code&#x202f;&#xbb; " \
105
- "and&#x202f;: code&#x202f;!"
106
- expect(e.encode(c.l10n("http://xyz a;b"), :hexadecimal))
107
- .to be_equivalent_to "http://xyz a;b"
108
- end
109
-
110
- it "does boolean conjunctions" do
111
- c = IsoDoc::I18n.new("en", "Latn")
112
- expect(c.boolean_conj([], "and")).to eq ""
113
- expect(c.boolean_conj(%w(a), "and")).to eq "a"
114
- expect(c.boolean_conj(%w(a b), "and")).to eq "a and b"
115
- expect(c.boolean_conj(%w(a b c), "and")).to eq "a, b, and c"
116
- expect(c.boolean_conj(%w(a b c d), "and")).to eq "a, b, c, and d"
117
- end
118
-
119
- it "does German ordinals" do
120
- c = IsoDoc::I18n.new("de", "Latn", i18nyaml: "spec/assets/de.yaml")
121
- term = c.inflection[c.edition]
122
- expect(c.inflect_ordinal(5, term, "SpelloutRules"))
123
- .to eq "fünfte"
124
- end
125
-
126
- it "does Chinese ordinals" do
127
- c = IsoDoc::I18n.new("zh", "Hans", i18nyaml: "spec/assets/zh-Hans.yaml")
128
- term = c.inflection[c.edition]
129
- expect(c.inflect_ordinal(5, term, "SpelloutRules"))
130
- .to eq "第五"
131
- end
132
-
133
- it "does Klingon ordinals" do
134
- c = IsoDoc::I18n.new("tlh", "Hans", i18nyaml: "spec/assets/zh-Hans.yaml")
135
- term = c.inflection[c.edition]
136
- expect(c.inflect_ordinal(5, term, "SpelloutRules"))
137
- .to eq "fifth"
138
- end
139
-
140
- it "does inflections" do
141
- c = IsoDoc::I18n.new("en", "Latn", i18nyaml: "spec/assets/new.yaml")
142
- expect(c.inflect("John", number: "sg")).to eq "John"
143
- expect(c.inflect("Fred", number: "sg")).to eq "Fred"
144
- expect(c.inflect("Fred", number: "pl")).to eq "Freds"
145
- expect(c.inflect("Fred", number: "du")).to eq "Fred"
146
- expect(c.inflect("Fred", tense: "pres")).to eq "Fred"
147
- expect(c.inflect("Man", case: "dat")).to eq "viri"
148
- expect(c.inflect("Man", number: "sg", case: "dat")).to eq "viri"
149
- expect(c.inflect("Man", number: "pl", case: "acc")).to eq "virem"
150
- expect(c.inflect("Woman", number: "pl", case: "gen")).to eq "mulierum"
151
- expect(c.inflect("Good", number: "pl", case: "gen")).to eq "bonorum"
152
- expect(c.inflect("Good", number: "pl", case: "gen", gender: "fem"))
153
- .to eq "bonarum"
154
- expect(c.inflect("Walk", person: "2nd")).to eq "ambulas"
155
- expect(c.inflect("Walk", person: "2nd", number: "pl", mood: "subj"))
156
- .to eq "ambuletis"
157
- end
158
- end
data/spec/spec_helper.rb DELETED
@@ -1,36 +0,0 @@
1
- require "simplecov"
2
- SimpleCov.start do
3
- add_filter "/spec/"
4
- end
5
-
6
- require "bundler/setup"
7
- require "isodoc-i18n"
8
- require "rspec/matchers"
9
- require "equivalent-xml"
10
- require "rexml/document"
11
-
12
- RSpec.configure do |config|
13
- # Enable flags like --only-failures and --next-failure
14
- config.example_status_persistence_file_path = ".rspec_status"
15
-
16
- # Disable RSpec exposing methods globally on `Module` and `main`
17
- config.disable_monkey_patching!
18
-
19
- config.expect_with :rspec do |c|
20
- c.syntax = :expect
21
- end
22
- end
23
-
24
- def xmlpp(xml)
25
- s = ""
26
- f = REXML::Formatters::Pretty.new(2)
27
- f.compact = true
28
- f.write(REXML::Document.new(xml), s)
29
- s
30
- end
31
-
32
- def metadata(hash)
33
- hash.sort.to_h.delete_if do |_k, v|
34
- v.nil? || (v.respond_to?(:empty?) && v.empty?)
35
- end
36
- end