relaton-render 3.0.0.pre.alpha.31 → 3.0.0.pre.alpha.32
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4910f5153470cbaeb2050385fe5b2fb310f0d8028e64a946c419b3fd3d772df
|
|
4
|
+
data.tar.gz: ea045152f9a08da7b2548df4c41bcd39fa6195d4bcffc9119231ccdd85a91743
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99e29f76607ff8c1e0b84ef5fbf9fb56c9291bb87c0ecb6d771679d2a9a7f12aaa0140692fdef6f665bdd9b9e278feaf59d2466591843ada74fc4d68740bd951
|
|
7
|
+
data.tar.gz: b5a937aae90ad6771126ece89b64bce89dc92f7fa60bebdca3719885197878125fa4d579e89990f13bc94111fc0b82dcb901d59b490ea00acca95cf8c6fccce5
|
|
@@ -14,14 +14,16 @@ module Relaton
|
|
|
14
14
|
def render
|
|
15
15
|
return "#{@i18n.label('version')} #{raw}" unless word_edition?
|
|
16
16
|
|
|
17
|
-
# The worded forms first ("
|
|
18
|
-
# ordinal template
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
# The exact worded forms first ("first edition", "第1版"),
|
|
18
|
+
# then the generic ordinal template, the cardinal last: a
|
|
19
|
+
# specific label outranks a template that would apply to
|
|
20
|
+
# any number
|
|
22
21
|
word = @i18n.label("edition_#{number}")
|
|
23
22
|
return word unless word == "edition_#{number}"
|
|
24
23
|
|
|
24
|
+
ordinal = locale_template("edition_ordinal", number)
|
|
25
|
+
return ordinal if ordinal
|
|
26
|
+
|
|
25
27
|
cardinal_form || "#{ordinalize(number)} #{@i18n.label('edition')}"
|
|
26
28
|
end
|
|
27
29
|
|
|
@@ -39,12 +39,18 @@ module Relaton
|
|
|
39
39
|
"available_at" => "available_from",
|
|
40
40
|
}.freeze
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
# The named attributes' label map alone: a delta's named
|
|
43
|
+
# attribute (availableAt) outranks the base pack's labels
|
|
44
|
+
# hash carrying the same label key
|
|
45
|
+
def named_label_map
|
|
46
|
+
LABEL_FOR.filter_map do |attr, label|
|
|
44
47
|
value = public_send(attr)
|
|
45
48
|
[label, value] unless value.nil?
|
|
46
49
|
end.to_h
|
|
47
|
-
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def label_map
|
|
53
|
+
named_label_map.merge(labels || {})
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
end
|
|
@@ -176,7 +176,12 @@ module Relaton
|
|
|
176
176
|
locale.in_str ||= base_locale.in_str
|
|
177
177
|
locale.at ||= base_locale.at
|
|
178
178
|
locale.available_at ||= base_locale.available_at
|
|
179
|
-
|
|
179
|
+
# delta labels win per key; the base's label map only fills
|
|
180
|
+
# gaps. Hash#merge! yields |key, receiver, other|, so the
|
|
181
|
+
# delta value is the second argument.
|
|
182
|
+
locale.labels.merge!(base_locale.label_map) { |_k, delta, _base| delta }
|
|
183
|
+
# a delta's named attributes assert over the inherited labels
|
|
184
|
+
locale.named_label_map.each_key { |k| locale.labels.delete(k) }
|
|
180
185
|
locale.punct = (base_locale.punct || {}).merge(locale.punct || {})
|
|
181
186
|
end
|
|
182
187
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-render
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.0.pre.alpha.
|
|
4
|
+
version: 3.0.0.pre.alpha.32
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: htmlentities
|