instant18n 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/instant18n-0.1.0.gem +0 -0
- data/lib/instant18n/helper.rb +15 -0
- data/lib/instant18n/version.rb +1 -1
- metadata +4 -3
- data/.env +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af3564289cdc4981a333fb0c025cd2d0516c2ac02ab58b2400a908bfa868d433
|
4
|
+
data.tar.gz: 259eaded36cebdc81ca9be6aa2b6ee0e92746134adccc4bbf97a2a92b5c8c1d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7636f2d73fbda914f291852f622fdfd929d8a0e55fd72655ae157d2a0d158b5225a152e07342d67ea6dcd2edbae51d94c500af8f70ee3012d46d631cfa066a
|
7
|
+
data.tar.gz: 001adadd86524419b2b8bb56aef909136c0f93449da4cead10c2ff1b2e59cfd7ed160c56209c81a68b9f45e8d7de33328e16e9eb48ce5487eae51844ec737a17
|
data/README.md
CHANGED
@@ -50,6 +50,10 @@ Additional options that are passed to the GPT-3 API:
|
|
50
50
|
|
51
51
|
Full description of these options is available [here](https://platform.openai.com/docs/api-reference/chat/create).
|
52
52
|
|
53
|
+
### View Helper
|
54
|
+
|
55
|
+
This gem mixes in an `it` helper method into `ActionView::Base`. For convenience, the helper method assumes the presence of a `current_user` object with a `preferred_language` attribute. If `current_user` is nil, it will use the value of `I18n.default_language` instead.
|
56
|
+
|
53
57
|
### Default Language
|
54
58
|
|
55
59
|
The default language is set to `English`. For performance and practical reasons, if you pass in the default language, GPT is not invoked. Change the default language in an initializer or at runtime by changing the value of the `default_language` property on the `I18n` module.
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "action_view"
|
4
|
+
|
5
|
+
module Instant18n
|
6
|
+
module Helper
|
7
|
+
def it(key, **opts)
|
8
|
+
lang = current_user&.preferred_language
|
9
|
+
lang ||= I18n.default_language
|
10
|
+
I18n.it(key, lang, **opts)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
ActionView::Base.include Instant18n::Helper
|
data/lib/instant18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instant18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Obie Fernandez
|
@@ -74,7 +74,6 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".env"
|
78
77
|
- ".rspec"
|
79
78
|
- ".rubocop.yml"
|
80
79
|
- CHANGELOG.md
|
@@ -84,9 +83,11 @@ files:
|
|
84
83
|
- LICENSE.txt
|
85
84
|
- README.md
|
86
85
|
- Rakefile
|
86
|
+
- instant18n-0.1.0.gem
|
87
87
|
- instant18n.gemspec
|
88
88
|
- lib/i18n_extensions.rb
|
89
89
|
- lib/instant18n.rb
|
90
|
+
- lib/instant18n/helper.rb
|
90
91
|
- lib/instant18n/version.rb
|
91
92
|
- log/development.log
|
92
93
|
- sig/instant18n.rbs
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
- !ruby/object:Gem::Version
|
114
115
|
version: '0'
|
115
116
|
requirements: []
|
116
|
-
rubygems_version: 3.4.
|
117
|
+
rubygems_version: 3.4.12
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Instant18n is a gem that makes it drop-dead simple to internationalize your
|