amazing-activist 0.5.1 → 0.5.2

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
2
  SHA256:
3
- metadata.gz: e1b67a3e5f375db018b80c5576790c70199cab89e8e352bf2700f06e2efa8678
4
- data.tar.gz: 313e959d99e39ec6c6c759748bdd08889c73945388ed5240e5919043968558f5
3
+ metadata.gz: 1fab0193cbbc4c13ab7e7f2162143de36d01369aa84090020c4903164c9be3eb
4
+ data.tar.gz: ce39998e2d99ab98dcd504b52f634ce0ad829fa0063ddb646a64627a21348f92
5
5
  SHA512:
6
- metadata.gz: 2f97922ccb1e84836578e2103f17b34e6a0081d29f6370aac8438b9cfdbf53974c3d14ab66f92f56569ca2481c0000e069db0967be80614578d7edf8881f7bfa
7
- data.tar.gz: a53cc57eb23851df4af94092f83506fc23d79769158d8ac7105badd94742d68e08959add4746eb41f767bb1fd2b0fec082ee161caf73722a200420a96cd68a72
6
+ metadata.gz: d0c769b8a3b3ddfc1c1595c05c3b1093db5679c5a8f2ca2ef6076402113cb390b62ac4617b29e447426be8602f6df6825427b0e70d05e2c980747ddc98977b0a
7
+ data.tar.gz: bc41b347b777da6516b4b1fbc08006816f953d79219f47df93a4e8530e3de60383f7441045c42ab7b300f17d3d8d9bc20902f59ca4222c11499573551933f199
data/CHANGES.md CHANGED
@@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.2] - 2024-08-30
10
11
 
11
- ## [0.5.1] - 2023-04-26
12
+ ### Changed
13
+
14
+ - i18n now looks for keys without `amazing_activist` prefix as well; Lookup
15
+ order now goes like: `amazing_activist.activities.[activity].failures`,
16
+ `activities.[activity].failures`, `amazing_activist.failures`,
17
+ `activities.failures`, with fallback to hardcoded `"<[activity]> failed - [code]"`.
18
+
19
+
20
+ ## [0.5.1] - 2024-04-26
12
21
 
13
22
  ### Changed
14
23
 
@@ -16,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
25
  keys are present and do not include it.
17
26
 
18
27
 
19
- ## [0.5.0] - 2023-03-13
28
+ ## [0.5.0] - 2024-03-13
20
29
 
21
30
  ### Changed
22
31
 
@@ -17,13 +17,17 @@ module AmazingActivist
17
17
  # The i18n key for the message will be looked in namespaces:
18
18
  #
19
19
  # * `amazing_activist.activities.[activity].failures`
20
+ # * `activities.[activity].failures`
20
21
  # * `amazing_activist.failures`
22
+ # * `activities.failures`
21
23
  #
22
24
  # Thus, if activity `Pretty::DamnGoodActivity` failed with `:bad_choise`
23
25
  # code the lookup will be:
24
26
  #
25
27
  # * `amazing_activist.activities.pretty/damn_good_activity.failures.bad_choice
28
+ # * `activities.pretty/damn_good_activity.failures.bad_choice
26
29
  # * `amazing_activist.failures.bad_choice
30
+ # * `activities.failures.bad_choice
27
31
  #
28
32
  # If there's no translation with any of the above keys, a generic
29
33
  # non-translated message will be used:
@@ -32,14 +36,16 @@ module AmazingActivist
32
36
  #
33
37
  # @return [String] Failure message
34
38
  def message(code, **context)
35
- default = [
39
+ activity = @activity.class.name&.underscore
40
+ default = [
36
41
  :"amazing_activist.failures.#{code}",
42
+ :"activities.failures.#{code}",
37
43
  "<%{activity}> failed - %{code}" # rubocop:disable Style/FormatStringToken
38
44
  ]
39
45
 
40
- if @activity.class.name
41
- activity = @activity.class.name.underscore.presence
46
+ if activity
42
47
  i18n_key = :"amazing_activist.activities.#{activity}.failures.#{code}"
48
+ default.unshift(:"activities.#{activity}.failures.#{code}")
43
49
  else
44
50
  activity = "(anonymous activity)"
45
51
  i18n_key = default.shift
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AmazingActivist
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazing-activist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Zapparov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-26 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -69,9 +69,9 @@ licenses:
69
69
  - MIT
70
70
  metadata:
71
71
  homepage_uri: https://github.com/ixti/amazing-activist
72
- source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.5.1
72
+ source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.5.2
73
73
  bug_tracker_uri: https://github.com/ixti/amazing-activist/issues
74
- changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.5.1/CHANGES.md
74
+ changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.5.2/CHANGES.md
75
75
  rubygems_mfa_required: 'true'
76
76
  post_install_message:
77
77
  rdoc_options: []
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.5.4
91
+ rubygems_version: 3.5.11
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Your friendly neighborhood activist.