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.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/lib/phlex/translation.rb +23 -0
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba5e76793c6b67d071fd6ef21dde6e5dc3641dd55696edb72c01569bb85754d0
|
4
|
+
data.tar.gz: 3b53d448773e2b92376ab93b6db7ef87af4f5eff792093ae970861b33f0f6297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e1bf7e860b688bd20e6dd1a781662f55a62dc5f178886687cd003bab7ac22271e68f2195f2c35b89cf895b84af3da42087bf2b51f469d995326ad1bd6eb7282
|
7
|
+
data.tar.gz: 77afb245a2f2683d351f22e56ad3f73bacc35c41d7f72e704322b31b4448b2b01d3655b47f197836f05d81d67fb492da5a3b908579f5c6622d8aa3af1708a96f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
# `phlex-
|
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
|
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-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: phlex
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
26
|
+
version: '0.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
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
|