phlex-translation 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/README.md +1 -1
  4. data/lib/phlex/translation.rb +23 -0
  5. metadata +11 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37b49e081d77e28d50e1e4a373e89bc65601937a62a6038c8a02e6990f9fa7d9
4
- data.tar.gz: 23b97a671cae4b1a9d55d14729c5e39c9503451e7e04b8a6fde96a4340665de4
3
+ metadata.gz: ba5e76793c6b67d071fd6ef21dde6e5dc3641dd55696edb72c01569bb85754d0
4
+ data.tar.gz: 3b53d448773e2b92376ab93b6db7ef87af4f5eff792093ae970861b33f0f6297
5
5
  SHA512:
6
- metadata.gz: da1b6fd8f0728992b0ba444dfbf755ac725e8261c64c5dea3027e57d0afd9d2daa40ef02f45770b63b6217e497fb4a660c82547dab780f158e3ec95b63a84604
7
- data.tar.gz: d1bc850ea5194da87286f5a60d02996b03dbf638334bae7e27e4447cdb5fa98da22bca04126de1b5a6d0304dff2692fa7c1624f90de21fab6fb09c1665b1a12d
6
+ metadata.gz: 7e1bf7e860b688bd20e6dd1a781662f55a62dc5f178886687cd003bab7ac22271e68f2195f2c35b89cf895b84af3da42087bf2b51f469d995326ad1bd6eb7282
7
+ data.tar.gz: 77afb245a2f2683d351f22e56ad3f73bacc35c41d7f72e704322b31b4448b2b01d3655b47f197836f05d81d67fb492da5a3b908579f5c6622d8aa3af1708a96f
data/Gemfile CHANGED
@@ -6,7 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
6
  gemspec
7
7
 
8
8
  gem "phlex", github: "joeldrapper/phlex"
9
- gem "capybara"
10
9
  gem "rubocop"
11
10
  gem "solargraph"
12
11
  gem "sus"
data/README.md CHANGED
@@ -1 +1 @@
1
- # `phlex-compiler`
1
+ # `phlex-translation`
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlex
4
+ module Translation
5
+ def self.included(view)
6
+ view.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ attr_writer :translation_path
11
+
12
+ def translation_path
13
+ @translation_path ||= name&.split("::")&.join(".")&.downcase.to_s
14
+ end
15
+ end
16
+
17
+ def translate(key, **options)
18
+ key = "#{self.class.translation_path}#{key}" if key.start_with?(".")
19
+
20
+ ::I18n.translate(key, **options)
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-19 00:00:00.000000000 Z
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: i18n
14
+ name: phlex
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.12'
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.12'
26
+ version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: phlex
28
+ name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: '1.12'
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: '0.5'
40
+ version: '1.12'
41
41
  description: A translation plugin for Phlex
42
42
  email:
43
43
  - joel@drapper.me
@@ -52,6 +52,7 @@ files:
52
52
  - LICENSE.txt
53
53
  - README.md
54
54
  - SECURITY.md
55
+ - lib/phlex/translation.rb
55
56
  homepage: https://github.com/joeldrapper/phlex-translation
56
57
  licenses:
57
58
  - MIT