inline_translation 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +15 -0
- data/Gemfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +144 -0
- data/Rakefile +12 -0
- data/app/controllers/translations_controller.rb +42 -0
- data/config/initializers/babbel.rb +2 -0
- data/config/routes.rb +3 -0
- data/inline_translation.gemspec +28 -0
- data/lib/generators/inline_translation/install/install_generator.rb +24 -0
- data/lib/generators/inline_translation/install/templates/add_inline_translations.rb +16 -0
- data/lib/generators/inline_translation/install/templates/create.js.erb +4 -0
- data/lib/generators/inline_translation/install/templates/inline_translation.rb +1 -0
- data/lib/inline_translation.rb +42 -0
- data/lib/inline_translation/concerns/acts_as_translatable.rb +17 -0
- data/lib/inline_translation/concerns/translatable.rb +17 -0
- data/lib/inline_translation/config/routes.rb +3 -0
- data/lib/inline_translation/engine.rb +4 -0
- data/lib/inline_translation/helpers/translations_helper.rb +26 -0
- data/lib/inline_translation/models/translation.rb +9 -0
- data/lib/inline_translation/services/translation_service.rb +36 -0
- data/lib/inline_translation/translators/base.rb +25 -0
- data/lib/inline_translation/translators/bing.rb +21 -0
- data/lib/inline_translation/translators/null.rb +18 -0
- data/lib/inline_translation/version.rb +3 -0
- metadata +50 -48
- data/test/babbel_integration_test.rb +0 -34
- data/test/fixtures/application_controller.rb +0 -3
- data/test/fixtures/rails.rb +0 -36
- data/test/lib/babbel_test.rb +0 -9
- data/test/lib/concerns/acts_as_translatable_test.rb +0 -62
- data/test/lib/concerns/translatable_test.rb +0 -31
- data/test/lib/controllers/translations_controller_test.rb +0 -62
- data/test/lib/generators/babbel_generator_install_test.rb +0 -22
- data/test/lib/helpers/translations_helper_test.rb +0 -61
- data/test/lib/models/translation_test.rb +0 -55
- data/test/lib/services/translation_service_test.rb +0 -69
- data/test/lib/translators/base_test.rb +0 -65
- data/test/lib/translators/bing_test.rb +0 -39
- data/test/lib/translators/null_test.rb +0 -20
- data/test/test_helper.rb +0 -74
- data/test/test_types/controller_test.rb +0 -6
- data/test/test_types/integration_test.rb +0 -2
- data/test/test_types/unit_test.rb +0 -3
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TranslatableTest < UnitTest
|
4
|
-
describe InlineTranslation::Concerns::Translatable do
|
5
|
-
|
6
|
-
let(:model) { ConcernModel.create column1: "test text" }
|
7
|
-
|
8
|
-
before do
|
9
|
-
setup_model :concern_model
|
10
|
-
include_translatable ConcernModel
|
11
|
-
end
|
12
|
-
|
13
|
-
it "has_many translations" do
|
14
|
-
assert_respond_to model, :translations
|
15
|
-
assert_instance_of InlineTranslation::Models::Translation, model.translations.build
|
16
|
-
end
|
17
|
-
|
18
|
-
it "destroys translations after update" do
|
19
|
-
model.translations.build language: :en, field: :column1, translation: "test translation"
|
20
|
-
model.save
|
21
|
-
assert_equal model.reload.translations.size, 1
|
22
|
-
|
23
|
-
model.update! column1: "changed text"
|
24
|
-
model.save
|
25
|
-
|
26
|
-
assert_equal model.reload.translations.size, 0
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TranslationsControllerTest < ControllerTest
|
4
|
-
describe InlineTranslation::Controllers::TranslationsController do
|
5
|
-
setup_model :controller_model
|
6
|
-
let(:service) { InlineTranslation::Services::TranslationService.new }
|
7
|
-
let(:translatable) { ControllerModel.create }
|
8
|
-
let(:translation_result) { { column1: 'A translation!', column2: 'A translation!' } }
|
9
|
-
|
10
|
-
setup do
|
11
|
-
ControllerModel.class_eval "acts_as_translatable on: [:column1, :column2]"
|
12
|
-
@controller ||= InlineTranslation::Controllers::TranslationsController.new
|
13
|
-
translatable
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "POST create" do
|
17
|
-
it "returns the translation for successful translation for JSON" do
|
18
|
-
InlineTranslation.stubs(:ready?).returns(true)
|
19
|
-
InlineTranslation::Translators::Null.any_instance.stubs(:can_translate?).returns(true)
|
20
|
-
InlineTranslation::Translators::Null.any_instance.stubs(:translate).returns("A translation!")
|
21
|
-
post :create, translatable_type: "ControllerModel", translatable_id: translatable.id, format: :json
|
22
|
-
|
23
|
-
assert_equal response.status, 200
|
24
|
-
json = JSON.parse(response.body)
|
25
|
-
|
26
|
-
assert_equal json.length, translatable.translations.size
|
27
|
-
fields = json.map { |t| t['field'] }
|
28
|
-
translatable_ids = json.map { |t| t['translatable_id'] }
|
29
|
-
translatable_types = json.map { |t| t['translatable_type'] }
|
30
|
-
|
31
|
-
assert_includes fields, 'column1'
|
32
|
-
assert_includes fields, 'column2'
|
33
|
-
assert_includes translatable_ids, translatable.id
|
34
|
-
assert_includes translatable_types, 'ControllerModel'
|
35
|
-
end
|
36
|
-
|
37
|
-
it "returns the translation for successful translation for JS" do
|
38
|
-
# TODO: stub out the call to render, which errors because we don't have a translations#create view
|
39
|
-
skip "Stub out render call so there's no 'cannot find translations#create view' error"
|
40
|
-
InlineTranslation::Translators::Null.any_instance.stubs(:can_translate?).returns(true)
|
41
|
-
InlineTranslation::Translators::Null.any_instance.stubs(:translate).returns("A translation!")
|
42
|
-
ActionView::Renderer.any_instance.stubs(:render).with('translations/create').returns('wark')
|
43
|
-
post :create, translatable_type: "ControllerModel", translatable_id: translatable.id, format: :js
|
44
|
-
|
45
|
-
assert_equal response.status, 200
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
it "returns unprocessable entity for unsuccessful translation" do
|
50
|
-
InlineTranslation::Services::TranslationService.any_instance.stubs(:translate).returns(false)
|
51
|
-
post :create, translatable_type: "ControllerModel", translatable_id: translatable.id, format: :json
|
52
|
-
assert_equal response.status, 422
|
53
|
-
end
|
54
|
-
|
55
|
-
it "returns unprocessable entity when translatable_type is not defined" do
|
56
|
-
InlineTranslation::Services::TranslationService.any_instance.stubs(:translate).returns(false)
|
57
|
-
post :create, format: :json
|
58
|
-
assert_equal response.status, 422
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'generators/inline_translation/install/install_generator'
|
3
|
-
|
4
|
-
class InlineTranslationGeneratorInstallTest < Rails::Generators::TestCase
|
5
|
-
tests InlineTranslation::InstallGenerator
|
6
|
-
setup_destination
|
7
|
-
|
8
|
-
test "generates a migration file" do
|
9
|
-
run_generator
|
10
|
-
assert_migration "db/migrate/add_inline_translations.rb"
|
11
|
-
end
|
12
|
-
|
13
|
-
test "generates an initializer file" do
|
14
|
-
run_generator
|
15
|
-
assert_file "config/initializers/inline_translation.rb"
|
16
|
-
end
|
17
|
-
|
18
|
-
test "generates a create js view file" do
|
19
|
-
run_generator
|
20
|
-
assert_file "app/views/translations/create.js.erb"
|
21
|
-
end
|
22
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TranslationsHelperTest < UnitTest
|
4
|
-
include InlineTranslation::Helpers::TranslationsHelper
|
5
|
-
include Rails.application.routes.url_helpers
|
6
|
-
|
7
|
-
setup_model :helper_model
|
8
|
-
|
9
|
-
let(:model) { HelperModel.new column1: 'a value', language: :en }
|
10
|
-
|
11
|
-
before do
|
12
|
-
I18n.locale = :fr
|
13
|
-
end
|
14
|
-
|
15
|
-
describe ".translate_link_for" do
|
16
|
-
it "returns a link with another locale set" do
|
17
|
-
assert_match /\?to=fr/, translate_link_for(model)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "returns a link with a specified locale" do
|
21
|
-
I18n.locale = :en
|
22
|
-
assert_match /\?to=fr/, translate_link_for(model, to: :fr)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "defaults to 'Translate' for link text" do
|
26
|
-
assert_match /Translate/, translate_link_for(model)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "accepts a text parameter" do
|
30
|
-
assert_match /Other text/, translate_link_for(model, text: 'Other text')
|
31
|
-
end
|
32
|
-
|
33
|
-
it "does not return a link when locale is the same" do
|
34
|
-
I18n.locale = :en
|
35
|
-
refute translate_link_for(model)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "does not return a link when specified locale is the same" do
|
39
|
-
refute translate_link_for(model, to: :en)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe ".translated_element_for" do
|
44
|
-
it "returns an span with a language class" do
|
45
|
-
assert_match /to-fr/, translated_element_for(model, :column1)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "returns a span with a field class" do
|
49
|
-
assert_match /column1-translated/, translated_element_for(model, :column1)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "returns a span with a InlineTranslation class" do
|
53
|
-
assert_match /inline-translation-translated/, translated_element_for(model, :column1)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "accepts an element parameter" do
|
57
|
-
assert_match /<div/, translated_element_for(model, :column1, element: :div)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inline_translation/models/translation'
|
3
|
-
|
4
|
-
class TranslationTest < UnitTest
|
5
|
-
describe InlineTranslation::Models::Translation do
|
6
|
-
|
7
|
-
setup_model :model_class
|
8
|
-
let(:translation) { InlineTranslation::Models::Translation.new translatable: ModelClass.new,
|
9
|
-
language: :en,
|
10
|
-
field: :field_name,
|
11
|
-
translation: :translation }
|
12
|
-
|
13
|
-
it "should be valid when all fields are present" do
|
14
|
-
assert translation.valid?
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should have a translatable" do
|
18
|
-
assert_respond_to translation, :translatable
|
19
|
-
assert_instance_of ModelClass, translation.translatable
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should require a translatable" do
|
23
|
-
translation.translatable = nil
|
24
|
-
refute translation.valid?
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should have a language" do
|
28
|
-
assert_equal translation.language, :en
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should require a language" do
|
32
|
-
translation.language = nil
|
33
|
-
refute translation.valid?
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should have a field name" do
|
37
|
-
assert_equal translation.field, :field_name
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should require a field name" do
|
41
|
-
translation.field = nil
|
42
|
-
refute translation.valid?
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should have a translation" do
|
46
|
-
assert_equal translation.translation, :translation
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should require a translation" do
|
50
|
-
translation.translation = nil
|
51
|
-
refute translation.valid?
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inline_translation/services/translation_service'
|
3
|
-
require 'inline_translation/models/translation'
|
4
|
-
|
5
|
-
class InlineTranslationTranslationServiceTest < UnitTest
|
6
|
-
setup_model :service_model
|
7
|
-
setup_translation
|
8
|
-
|
9
|
-
let(:translator_class) { InlineTranslation::Translators::Base }
|
10
|
-
let(:service) { InlineTranslation::Services::TranslationService.new(translator_class) }
|
11
|
-
let(:translatable) { ServiceModel.new column1: "translatable text", column2: "more text", language: :en }
|
12
|
-
|
13
|
-
before do
|
14
|
-
ServiceModel.class_eval "acts_as_translatable on: [:column1, :column2]"
|
15
|
-
include_translatable ServiceModel
|
16
|
-
translator_class.stubs(:ready?).returns(true)
|
17
|
-
service.translator.stubs(:can_translate?).returns(true)
|
18
|
-
service.translator.stubs(:translate).returns("translation")
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "initialize" do
|
22
|
-
it "sets a translator object on initialize" do
|
23
|
-
assert_equal service.translator.class, translator_class
|
24
|
-
end
|
25
|
-
it "raises an error on initialize if translator is not ready" do
|
26
|
-
translator_class.stubs(:ready?).returns(false)
|
27
|
-
->{ InlineTranslation::Services::TranslationService.new(translator_class) }.must_raise InlineTranslation::Services::InvalidTranslatorError
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "invalid translator error" do
|
32
|
-
it "has an error message" do
|
33
|
-
assert_match /Unable to instantiate translator/, InlineTranslation::Services::InvalidTranslatorError.new.to_s
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "translate" do
|
38
|
-
it "returns the results of translate!" do
|
39
|
-
service.stubs(:translate!).returns("translation result")
|
40
|
-
assert_equal service.translate(translatable), "translation result"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "translate!" do
|
45
|
-
it "builds all translations using translate_field" do
|
46
|
-
service.translate!(translatable)
|
47
|
-
assert_equal translatable.translations.size, 2
|
48
|
-
end
|
49
|
-
|
50
|
-
it "does not build an invalid translation" do
|
51
|
-
service.translator.stubs(:can_translate?).returns(false)
|
52
|
-
service.translate!(translatable)
|
53
|
-
assert_equal translatable.translations.size, 0
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "translate_field" do
|
58
|
-
it "builds a translation with translate_field" do
|
59
|
-
service.translate_field(translatable, :column1)
|
60
|
-
assert_equal translatable.translations.size, 1
|
61
|
-
end
|
62
|
-
it "does not build an invalid translation" do
|
63
|
-
service.translator.stubs(:can_translate?).returns(false)
|
64
|
-
service.translate_field(translatable, :column1)
|
65
|
-
assert_equal translatable.translations.size, 0
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inline_translation/translators/base'
|
3
|
-
|
4
|
-
class BaseTest < UnitTest
|
5
|
-
describe InlineTranslation::Translators::Base do
|
6
|
-
setup_model :translator_model
|
7
|
-
|
8
|
-
let(:translator_class) { InlineTranslation::Translators::Base }
|
9
|
-
let(:translator) { translator_class.new }
|
10
|
-
let(:translatable) { TranslatorModel.new column1: "column one", language: :en }
|
11
|
-
|
12
|
-
setup do
|
13
|
-
TranslatorModel.acts_as_translatable on: :column1
|
14
|
-
end
|
15
|
-
|
16
|
-
it "returns false on ready?" do
|
17
|
-
refute translator_class.ready?
|
18
|
-
end
|
19
|
-
|
20
|
-
describe ".can_translate?" do
|
21
|
-
|
22
|
-
it "returns false if the translator is not ready" do
|
23
|
-
refute translator.can_translate? translatable, :column1, :fr
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns false if 'to' is not set" do
|
27
|
-
translator.stubs(:ready?).returns(:true)
|
28
|
-
refute translator.can_translate? translatable, :column1, nil
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns false if translatable's language is not set" do
|
32
|
-
translator.stubs(:ready?).returns(:true)
|
33
|
-
translatable.language = nil
|
34
|
-
refute translator.can_translate? translatable, :column1, :fr
|
35
|
-
end
|
36
|
-
|
37
|
-
it "returns false if the from and to language are the same" do
|
38
|
-
translator.stubs(:ready?).returns(:true)
|
39
|
-
refute translator.can_translate? translatable, :column1, :en
|
40
|
-
end
|
41
|
-
|
42
|
-
it "returns false if a translation already exists" do
|
43
|
-
translator.stubs(:ready?).returns(:true)
|
44
|
-
translatable.save
|
45
|
-
translatable.translations.create field: :column1, language: :fr
|
46
|
-
refute translator.can_translate? translatable, :column1, :fr
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns false if the field is not found on translatable" do
|
50
|
-
translator_class.stubs(:ready?).returns(:true)
|
51
|
-
refute translator.can_translate? translatable, :notacolumn, :fr
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns true otherwise" do
|
55
|
-
translator_class.stubs(:ready?).returns(:true)
|
56
|
-
assert translator.can_translate? translatable, :column1, :fr
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
it "raises an error on translate" do
|
61
|
-
assert_raises NotImplementedError do translator.translate(nil) end
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inline_translation/translators/base'
|
3
|
-
require 'inline_translation/translators/bing'
|
4
|
-
require 'bing_translator'
|
5
|
-
|
6
|
-
class BingTest < UnitTest
|
7
|
-
describe InlineTranslation::Translators::Bing do
|
8
|
-
|
9
|
-
let(:translator_class) { InlineTranslation:: Translators::Bing }
|
10
|
-
let(:translator) { translator_class.new }
|
11
|
-
|
12
|
-
before do
|
13
|
-
setup_bing_translator_env
|
14
|
-
end
|
15
|
-
|
16
|
-
it "initializes a BingTranslator" do
|
17
|
-
assert_instance_of BingTranslator, translator.translator
|
18
|
-
end
|
19
|
-
|
20
|
-
it "returns ready if ENV variables are set" do
|
21
|
-
assert translator_class.ready?
|
22
|
-
end
|
23
|
-
|
24
|
-
it "returns not ready if app id is not set" do
|
25
|
-
ENV['BING_TRANSLATOR_APP_ID'] = nil
|
26
|
-
refute translator_class.ready?
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns not ready if secret is not set" do
|
30
|
-
ENV['BING_TRANSLATOR_SECRET'] = nil
|
31
|
-
refute translator_class.ready?
|
32
|
-
end
|
33
|
-
|
34
|
-
it "can translate a translatable" do
|
35
|
-
translator.translator.stubs(:translate).returns("translation")
|
36
|
-
assert_equal translator.translate("original"), "translation"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'inline_translation/translators/base'
|
3
|
-
require 'inline_translation/translators/null'
|
4
|
-
|
5
|
-
class NullTest < UnitTest
|
6
|
-
describe InlineTranslation::Translators::Null do
|
7
|
-
|
8
|
-
let(:translator_class) { InlineTranslation::Translators::Null }
|
9
|
-
let(:translator) { translator_class.new }
|
10
|
-
|
11
|
-
it "returns ready as true" do
|
12
|
-
assert translator_class.ready?
|
13
|
-
end
|
14
|
-
|
15
|
-
it "returns nil as a translation" do
|
16
|
-
assert_nil translator.translate("anything")
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
ENV['RAILS_ENV'] = 'test'
|
2
|
-
|
3
|
-
require "codeclimate-test-reporter"
|
4
|
-
CodeClimate::TestReporter.start
|
5
|
-
|
6
|
-
require 'byebug'
|
7
|
-
require 'bundler/setup'
|
8
|
-
require 'active_record'
|
9
|
-
require 'temping'
|
10
|
-
ActiveRecord::Base.establish_connection adapter: :sqlite3, database: ':memory:'
|
11
|
-
|
12
|
-
require 'action_controller'
|
13
|
-
|
14
|
-
require 'fixtures/rails'
|
15
|
-
require 'fixtures/application_controller'
|
16
|
-
|
17
|
-
require 'minitest/autorun'
|
18
|
-
require 'minitest/pride'
|
19
|
-
require 'mocha/mini_test'
|
20
|
-
require 'rails/test_help'
|
21
|
-
|
22
|
-
require 'test_types/unit_test'
|
23
|
-
require 'test_types/controller_test'
|
24
|
-
require 'test_types/integration_test'
|
25
|
-
|
26
|
-
require 'inline_translation'
|
27
|
-
|
28
|
-
I18n.enforce_available_locales = false
|
29
|
-
|
30
|
-
def setup_destination
|
31
|
-
destination File.expand_path '../../../tmp', __FILE__
|
32
|
-
setup :prepare_destination
|
33
|
-
end
|
34
|
-
|
35
|
-
def setup_model(model = :test_model)
|
36
|
-
constantized = model.to_s.split("_").collect(&:capitalize).join
|
37
|
-
unless Object.const_defined?(constantized)
|
38
|
-
Temping.create model do
|
39
|
-
with_columns do |t|
|
40
|
-
t.integer :id_alt
|
41
|
-
t.string :column1, :column2, :language, :language_alt
|
42
|
-
end
|
43
|
-
end
|
44
|
-
include_acts_as_translatable Object.const_get(constantized)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def setup_translation
|
49
|
-
unless Object.const_defined?("Translation")
|
50
|
-
Temping.create :translation do
|
51
|
-
with_columns do |t|
|
52
|
-
t.integer :translatable_id
|
53
|
-
t.string :translatable_type
|
54
|
-
t.string :field
|
55
|
-
t.string :language
|
56
|
-
t.text :translation
|
57
|
-
t.timestamps
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def setup_bing_translator_env
|
64
|
-
ENV['BING_TRANSLATOR_APP_ID'] = 'set'
|
65
|
-
ENV['BING_TRANSLATOR_SECRET'] = 'set'
|
66
|
-
end
|
67
|
-
|
68
|
-
def include_acts_as_translatable(model)
|
69
|
-
model.class_eval "include InlineTranslation::Concerns::ActsAsTranslatable"
|
70
|
-
end
|
71
|
-
|
72
|
-
def include_translatable(model)
|
73
|
-
model.class_eval "include InlineTranslation::Concerns::Translatable"
|
74
|
-
end
|