isodoc-i18n 1.0.4 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.github/workflows/release.yml +24 -0
- data/isodoc-i18n.gemspec +1 -1
- data/lib/isodoc/i18n.rb +4 -3
- data/lib/isodoc/version.rb +1 -1
- data/spec/isodoc/base_spec.rb +12 -4
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce8cb0d922cdc28fe16fc3605db3d205fe66c12d0224282f6597d9510d44ee6d
|
4
|
+
data.tar.gz: 6fe8fc95e446fdc6b57eb9172d6f4d0665fd2f48ed0c29877819c3d8398805dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75991361380709948d84f9707bb999e3637f634433ebd83ee3f0b24e783381131326fa824e1897f8900a6cf8c30522a56589887fc93def7458480eadaaa60c21
|
7
|
+
data.tar.gz: 0e1a2149f1a06190962dda186978f01677d35ef25caf711dd058753741dca79b74c3de98cb04cbe0be4d1ba770b5f649589d7fd0b9f12e6dafb04b58372fa7fe
|
data/.github/workflows/rake.yml
CHANGED
@@ -0,0 +1,24 @@
|
|
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/isodoc-i18n.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
24
24
|
|
25
25
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
26
|
-
spec.add_dependency "metanorma-utils", "~> 1.
|
26
|
+
spec.add_dependency "metanorma-utils", "~> 1.4.0"
|
27
27
|
spec.add_dependency "twitter_cldr"
|
28
28
|
|
29
29
|
spec.add_development_dependency "debug"
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -5,9 +5,10 @@ require "twitter_cldr"
|
|
5
5
|
|
6
6
|
module IsoDoc
|
7
7
|
class I18n
|
8
|
-
def load_yaml(lang, script, i18nyaml = nil)
|
8
|
+
def load_yaml(lang, script, i18nyaml = nil, i18nhash = nil)
|
9
9
|
ret = load_yaml1(lang, script)
|
10
10
|
return normalise_hash(ret.merge(YAML.load_file(i18nyaml))) if i18nyaml
|
11
|
+
return normalise_hash(ret.merge(i18nhash)) if i18nhash
|
11
12
|
|
12
13
|
normalise_hash(ret)
|
13
14
|
end
|
@@ -53,10 +54,10 @@ module IsoDoc
|
|
53
54
|
@labels[key] = val
|
54
55
|
end
|
55
56
|
|
56
|
-
def initialize(lang, script, i18nyaml
|
57
|
+
def initialize(lang, script, i18nyaml: nil, i18nhash: nil)
|
57
58
|
@lang = lang
|
58
59
|
@script = script
|
59
|
-
y = load_yaml(lang, script, i18nyaml)
|
60
|
+
y = load_yaml(lang, script, i18nyaml, i18nhash)
|
60
61
|
@labels = y
|
61
62
|
@labels["language"] = @lang
|
62
63
|
@labels["script"] = @script
|
data/lib/isodoc/version.rb
CHANGED
data/spec/isodoc/base_spec.rb
CHANGED
@@ -30,7 +30,15 @@ RSpec.describe IsoDoc::I18n do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "loads language file overrides" do
|
33
|
-
c = IsoDoc::I18n.new("en", "Latn", "spec/assets/new.yaml")
|
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", i18nhash: YAML.load_file("spec/assets/new.yaml"))
|
34
42
|
expect(c.text).to eq "text2"
|
35
43
|
expect(c.at).to eq "at"
|
36
44
|
expect(c.hash.to_s).to be_equivalent_to '{"key1"=>"val1", "key2"=>"val2"}'
|
@@ -87,21 +95,21 @@ RSpec.describe IsoDoc::I18n do
|
|
87
95
|
end
|
88
96
|
|
89
97
|
it "does German ordinals" do
|
90
|
-
c = IsoDoc::I18n.new("de", "Latn", "spec/assets/de.yaml")
|
98
|
+
c = IsoDoc::I18n.new("de", "Latn", i18nyaml: "spec/assets/de.yaml")
|
91
99
|
term = c.inflection[c.edition]
|
92
100
|
expect(c.inflect_ordinal(5, term, "SpelloutRules"))
|
93
101
|
.to eq "fünfte"
|
94
102
|
end
|
95
103
|
|
96
104
|
it "does Chinese ordinals" do
|
97
|
-
c = IsoDoc::I18n.new("zh", "Hans", "spec/assets/zh-Hans.yaml")
|
105
|
+
c = IsoDoc::I18n.new("zh", "Hans", i18nyaml: "spec/assets/zh-Hans.yaml")
|
98
106
|
term = c.inflection[c.edition]
|
99
107
|
expect(c.inflect_ordinal(5, term, "SpelloutRules"))
|
100
108
|
.to eq "第五"
|
101
109
|
end
|
102
110
|
|
103
111
|
it "does Klingon ordinals" do
|
104
|
-
c = IsoDoc::I18n.new("tlh", "Hans", "spec/assets/zh-Hans.yaml")
|
112
|
+
c = IsoDoc::I18n.new("tlh", "Hans", i18nyaml: "spec/assets/zh-Hans.yaml")
|
105
113
|
term = c.inflection[c.edition]
|
106
114
|
expect(c.inflect_ordinal(5, term, "SpelloutRules"))
|
107
115
|
.to eq "fifth"
|
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.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: twitter_cldr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +202,7 @@ extensions: []
|
|
202
202
|
extra_rdoc_files: []
|
203
203
|
files:
|
204
204
|
- ".github/workflows/rake.yml"
|
205
|
+
- ".github/workflows/release.yml"
|
205
206
|
- ".hound.yml"
|
206
207
|
- ".rubocop.yml"
|
207
208
|
- CODE_OF_CONDUCT.md
|
@@ -224,7 +225,7 @@ homepage: https://github.com/metanorma/isodoc-i18n
|
|
224
225
|
licenses:
|
225
226
|
- BSD-2-Clause
|
226
227
|
metadata: {}
|
227
|
-
post_install_message:
|
228
|
+
post_install_message:
|
228
229
|
rdoc_options: []
|
229
230
|
require_paths:
|
230
231
|
- lib
|
@@ -239,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
- !ruby/object:Gem::Version
|
240
241
|
version: '0'
|
241
242
|
requirements: []
|
242
|
-
rubygems_version: 3.
|
243
|
-
signing_key:
|
243
|
+
rubygems_version: 3.1.6
|
244
|
+
signing_key:
|
244
245
|
specification_version: 4
|
245
246
|
summary: isodoc-i18n
|
246
247
|
test_files: []
|