active_translate_self 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +59 -0
- data/Rakefile +20 -0
- data/app/assets/config/active_translate_self_manifest.js +1 -0
- data/app/assets/stylesheets/active_translate_self/application.css +15 -0
- data/app/controllers/active_translate_self/application_controller.rb +6 -0
- data/app/helpers/active_translate_self/application_helper.rb +6 -0
- data/app/jobs/active_translate_self/application_job.rb +6 -0
- data/app/mailers/active_translate_self/application_mailer.rb +8 -0
- data/app/models/active_translate_self/application_record.rb +7 -0
- data/app/views/layouts/active_translate_self/application.html.erb +15 -0
- data/lib/active_translate_self.rb +18 -0
- data/lib/active_translate_self/core_ext.rb +7 -0
- data/lib/active_translate_self/engine.rb +8 -0
- data/lib/active_translate_self/version.rb +5 -0
- data/lib/tasks/active_translate_self_tasks.rake +5 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bdaaca8d015290db210333b86e82ea45ea0cbe4965e36dec0625223f30e06f40
|
4
|
+
data.tar.gz: 3d12d9fe405b2685d4a65874869876f6b299f544dbcc8d125bde7eb967197d37
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aba60d62355471e7406dcf7f00361123f977a68ff6519b61f3a3a19410401b9b45467b6aee68a04c56f1d4198277baa4ca4b9c13b3de76b22d1450934230e608
|
7
|
+
data.tar.gz: 1c171ee1f4896989e6304580875f262c8f97cf7fd774e443b04c3d54d21c1b2ee6a561807e3882671f8727ce9897947f932de5e4f07acbcdc1909b8911b51c50
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 Sampo Kuokkanen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# ActiveTranslateSelf
|
2
|
+
|
3
|
+
String! Translate yourself! A very хорошо gem!
|
4
|
+
|
5
|
+
Finnish, English, Japanese, Russian!
|
6
|
+
|
7
|
+
Translate Ruby strings in Rails to a language of your choice!
|
8
|
+
Any and all languages supported, as long as they're also supported by DeepL. If your language is not supported at the moment, you just need to wait a bit. Or make a PR for TranslateSelf to add Google Translate backend to it.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
Easy to use!
|
12
|
+
Just get a DeepL auth key (free!), and create an initializer(`config/initializers/active_translate_self.rb`), add the auth key to your Rails credentials file with the following command:
|
13
|
+
```shell
|
14
|
+
$ EDITOR="vim" rails credentials:edit
|
15
|
+
```
|
16
|
+
|
17
|
+
Inside, the file should look like below:
|
18
|
+
|
19
|
+
```yml
|
20
|
+
deepl:
|
21
|
+
auth_key: 'my-auth-key'
|
22
|
+
```
|
23
|
+
|
24
|
+
And the initializer should just read that value like below:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
ActiveTranslateSelf.auth_key = Rails.application.credentials.dig(:deepl, :auth_key)
|
28
|
+
```
|
29
|
+
|
30
|
+
## Installation
|
31
|
+
Add this line to your application's Gemfile:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
gem 'active_translate_self'
|
35
|
+
```
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
```bash
|
39
|
+
$ bundle
|
40
|
+
```
|
41
|
+
|
42
|
+
Or install it yourself as:
|
43
|
+
```bash
|
44
|
+
$ gem install active_translate_self
|
45
|
+
```
|
46
|
+
|
47
|
+
Build on top of TranslateSelf and DeepL for Ruby.
|
48
|
+
|
49
|
+
[TranslateSelf](https://github.com/sampokuokkanen/translate_self).
|
50
|
+
|
51
|
+
[DeepL for ruby](https://github.com/wikiti/deepl-rb).
|
52
|
+
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
Contributions are welcome!
|
56
|
+
Взносы приветствуются! Las contribuciones son bienvenidas! 投稿(コントリビューション)を歓迎します!
|
57
|
+
|
58
|
+
## License
|
59
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
|
5
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
6
|
+
load 'rails/tasks/engine.rake'
|
7
|
+
|
8
|
+
load 'rails/tasks/statistics.rake'
|
9
|
+
|
10
|
+
require 'bundler/gem_tasks'
|
11
|
+
|
12
|
+
require 'rake/testtask'
|
13
|
+
|
14
|
+
Rake::TestTask.new(:test) do |t|
|
15
|
+
t.libs << 'test'
|
16
|
+
t.pattern = 'test/**/*_test.rb'
|
17
|
+
t.verbose = false
|
18
|
+
end
|
19
|
+
|
20
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/active_translate_self .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Active translate self</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag "active_translate_self/application", media: "all" %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<%= yield %>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_translate_self/version'
|
4
|
+
require 'active_translate_self/engine'
|
5
|
+
require 'active_translate_self/core_ext'
|
6
|
+
|
7
|
+
# A Rails engine that connects TranslateSelf to Rails
|
8
|
+
module ActiveTranslateSelf
|
9
|
+
mattr_accessor :auth_key
|
10
|
+
mattr_accessor :host
|
11
|
+
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
DeepL.configure do |config|
|
14
|
+
config.auth_key = ActiveTranslateSelf.auth_key || ENV['DEEPL_AUTH_KEY']
|
15
|
+
config.host = ActiveTranslateSelf.host || 'https://api-free.deepl.com' # Default value is 'https://api.deepl.com'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_translate_self
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sampo Kuokkanen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: translate_self
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: |-
|
56
|
+
ActiveTranslateSelf is a Rails engine that hacks the Ruby string class and lets them translate \
|
57
|
+
themselves. Supports English, Finnish, Japanese, and others!
|
58
|
+
email:
|
59
|
+
- sampo.kuokkanen@gmail.com
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- MIT-LICENSE
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- app/assets/config/active_translate_self_manifest.js
|
68
|
+
- app/assets/stylesheets/active_translate_self/application.css
|
69
|
+
- app/controllers/active_translate_self/application_controller.rb
|
70
|
+
- app/helpers/active_translate_self/application_helper.rb
|
71
|
+
- app/jobs/active_translate_self/application_job.rb
|
72
|
+
- app/mailers/active_translate_self/application_mailer.rb
|
73
|
+
- app/models/active_translate_self/application_record.rb
|
74
|
+
- app/views/layouts/active_translate_self/application.html.erb
|
75
|
+
- lib/active_translate_self.rb
|
76
|
+
- lib/active_translate_self/core_ext.rb
|
77
|
+
- lib/active_translate_self/engine.rb
|
78
|
+
- lib/active_translate_self/version.rb
|
79
|
+
- lib/tasks/active_translate_self_tasks.rake
|
80
|
+
homepage: https://github.com/sampokuokkanen/ActiveTranslateSelf
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
homepage_uri: https://github.com/sampokuokkanen/ActiveTranslateSelf
|
85
|
+
source_code_uri: https://github.com/sampokuokkanen/ActiveTranslateSelf
|
86
|
+
changelog_uri: https://github.com/sampokuokkanen/ActiveTranslateSelf/CHANGELOG.md
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.5.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.2.15
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: ActiveTranslateSelf provides the strings in Rails an ability to translate
|
106
|
+
themselves.
|
107
|
+
test_files: []
|